# Routing and privacy

> What happens to a request between your code and the model, when the gateway retries (it does not), what it records about each call, and what it never stores.

Source: https://oneaiapikey.com/docs/routing-privacy

Every request you send to `api.oneaiapikey.com` goes through the same short path: the gateway checks it, forwards it to the provider that runs the model, streams the answer back and writes one usage record. This page describes each step, what is kept and what is not.

## How a request flows

1. **Your code sends the request** with your API key to `api.oneaiapikey.com`, in OpenAI or Anthropic format.
2. **The gateway checks the key.** It must exist, be enabled and not expired. If you set a spend limit, a model list or an IP allowlist on the key, the request must fit them. A failed check returns `401` or `403` and nothing is billed. See [Errors](https://oneaiapikey.com/docs/errors#access-denied).
3. **The gateway checks your balance.** It estimates the cost from the prompt. If your balance or the key’s spend limit cannot cover that estimate, the request stops here with `403`.
4. **The gateway forwards the request** to the provider that operates the model, using Relaykit’s own provider credentials. Your API key is never sent upstream. If your request and the provider use different formats, the gateway converts between them.
5. **The answer comes back** through the gateway. Streamed answers are passed on chunk by chunk as they arrive.
6. **The gateway meters the request.** It takes the token counts the provider reports, prices them at the [published rates](https://oneaiapikey.com/docs/models#current-models), settles the reserved amount and writes one usage record.

## Retries and failover

The gateway makes **one attempt** per request. If the provider answers with an error, or the connection to it fails, you get that error back with a request id. The gateway does not resend the request to another provider and does not switch you to a different model.

This keeps behaviour predictable: the model you name is the model that answers, and you are never billed twice for one call. It also means retrying is up to your code. The official OpenAI and Anthropic SDKs already retry `429`, `5xx` and connection errors; [Rate limits and retries](https://oneaiapikey.com/docs/rate-limits) shows how to tune that and when to switch to a sibling model.

## What the gateway records

Each request leaves one usage record, which you can see on the [usage page](https://oneaiapikey.com/console/usage) and export as CSV:

| Field | Example | Notes |
| --- | --- | --- |
| Time | date and time | When the request finished. The CSV uses UTC. |
| Key | the key’s name | The name you gave the key, never the key itself. |
| Model | the model id you sent |   |
| Tokens | input, output, cached | As reported by the provider. |
| Cost | the amount deducted | Tokens × rates, see [Pricing and billing](https://oneaiapikey.com/docs/billing). |
| Duration | whole seconds | From the gateway receiving the request to the last byte. |
| First token | milliseconds | Streamed requests only. See [Performance metrics](https://oneaiapikey.com/docs/performance). |
| Stream | yes or no |   |
| Request id | a long id | Also in the `X-Request-Id` response header. Quote it when you contact support. |

Failed requests leave a record too, with the error message instead of a cost. Usage records do not include your IP address or your user agent.

The gateway’s server log also records each HTTP request’s time, path, status code, duration and client IP address. It is used for security and troubleshooting and is not shown in the console.

> **Prompts and answers are not stored:** The gateway relays the content of your requests in memory to complete them. It does not write prompts, completions, images, files, tool definitions or tool results to the usage records or to its server log. Usage records hold token counts, not text.

## What the provider receives

To answer, the provider that runs the model receives the full request: your messages, system prompt, images, tools and parameters. Each provider processes it under its own API terms, which can include short-term retention for abuse monitoring. The [privacy policy](https://oneaiapikey.com/legal/privacy#prompts) explains this and names the providers.

The provider does not receive your API key, your email address or your account details. Fields you put in the request body yourself, such as `user` or `metadata`, are forwarded with it, so leave personal data out of them.

## Chat in the browser

Conversations on the [Relaykit chat](https://oneaiapikey.com/docs/chat) are stored only in your browser, separately for each account you sign in with. They are not uploaded, not synced between devices and not kept on our servers. Clearing this site’s data in your browser deletes them.

Each message you send is still an API request: it travels the path above, reaches the provider, and leaves a usage record with tokens and cost, but no text.

## Retention

How long usage records, server logs and billing records are kept, and how to ask for a copy or for deletion, is set out in the [privacy policy](https://oneaiapikey.com/legal/privacy#retention). Relaykit does not train models on your prompts or outputs and does not sell them.

## Related

- [Authentication and keys](https://oneaiapikey.com/docs/authentication#per-key-settings): spend limits, model lists and expiry per key.
- [Account security and alerts](https://oneaiapikey.com/docs/account-security): two-factor sign-in, IP allowlists and low-balance alerts.
- [Errors](https://oneaiapikey.com/docs/errors): every status code and what it means.
