Skip to navigation
DocsRouting and privacy

Account and billing

Routing and privacy

In short: Each request is checked, forwarded to the model's provider and metered; usage records hold tokens and cost, never prompts or answers.

Updated View .md
On this page

The gateway is a short path between your code and the model: every request you send to api.oneaiapikey.com is checked, forwarded to the provider that runs the model, streamed back and written to 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.
  3. The gateway checks your balance. It estimates the cost from the prompt and reserves that amount. If the balance or the key’s limit cannot cover it, the request stops here with 403.
  4. The gateway forwards the request to the provider that operates the model, using One AI API Key’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, settles the reserved amount and writes one usage record.

Retries and failover

When the provider fails before sending any part of the answer (a 429, a 5xx or an unavailable model), the gateway first retries the model you named, up to twice. If that fails too, it tries the fallback models you picked in advance:

  • Per request: up to 3 model ids in an X-Fallback-Models header, tried in order, for example X-Fallback-Models: deepseek-v4-flash, glm-5.3.
  • For every request: a fallback model chosen in the console under Models → Routing.

A reply from a fallback model carries X-Fallback-From with the model that failed, and its model field names the model that answered. Your model allowlist applies to each fallback. Only the attempt that answers is billed, so one call is never billed twice. Fallback covers text endpoints (chat completions, responses, messages); an error that arrives after the answer started streaming is passed on as it is.

Without a fallback, the error comes back with a request id and retrying is up to your code. The official OpenAI and Anthropic SDKs already retry 429, 5xx and connection errors; Rate limits and retries shows how to tune that and when to switch to a sibling model.

Virtual models and rules

In the console under Models → Routing you can add virtual models: a name of your own for a chain of up to 3 models. A request naming it tries them in order when one fails before answering. Replies carry X-Virtual-Model; the model field names the model that answered.

A virtual model can have rules that pick another chain from the request’s metadata (a body metadata object or an X-Metadata header); the first match wins and the reply carries X-Route-Rule. A canary sends 1 to 50% of the other requests to one model first; those replies carry X-Canary: 1.

The ids auto, auto:cheap and auto:best work the same way with a chain picked from the catalogue; X-Auto-Allow and X-Auto-Deny narrow it with id patterns.

What the gateway records

Each request leaves one usage record, which you can see on the usage page 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.
Duration whole seconds From the gateway receiving the request to the last byte.
First token milliseconds Streamed requests only. See Performance metrics.
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.

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.

Keep one call out of the prompt log. Send X-No-Log: true (or 1) on any /v1 request and that call is never stored in the prompt log, even when the key has logging on. Its usage and billing record is written as usual.

What do the content checks look at?

The content checks are pattern-based: each one finds what its patterns match and nothing else. It is not a classifier, it does not read images or files, and it never guesses.

Guardrails (per key)

Set in the key dialog under Guardrails. Three checks look at the text you send, before any provider is called: secrets (API keys, AWS, GitHub and Google tokens, Slack, Stripe, PEM private keys), prompt injection (phrases such as “ignore all previous instructions”, chat-template role markers) and source code (a fenced code block, or several lines that look like code). Each check is off, log or deny. A deny returns 400 guardrail_blocked, sends nothing upstream and bills nothing. You can add up to ten regular expressions of your own. The reply of a logged request names the checks that matched in X-Guardrail. Only requests made with that key are checked.

Blocked checks are listed on the usage page under Blocked by guardrails: key, model, the check that matched and, for a custom rule, its pattern. Blocked requests never become a row in the request table because nothing was sent or billed; the list shows the newest of the last 50 checks on the account, newest first, and follows no date range. A request that passed in log mode keeps its row, and that row names the checks that matched (up to the last 50 checks on the account).

PII redaction (per key)

Set in the same dialog under Redaction. Email addresses, phone numbers, payment-card numbers, IBANs, IP addresses and US SSNs are replaced with a placeholder such as [EMAIL] before the request leaves the gateway, and again in the reply. Card and IBAN candidates must pass their checksum. In a streamed reply the last 128 characters of each text block are held back until the next chunk shows they are not part of a match. Anthropic thinking blocks are signed by the model and pass unchanged. X-PII-Redaction names what was on.

What does data-loss prevention do?

Data-loss prevention is an account-wide rule, set on Security, that applies to every key on the account. You choose categories (payment cards, IBAN, US SSN, JSON Web Tokens, AWS keys, GitHub tokens, private keys) and up to ten patterns of your own, and one action:

  • Report: the request goes through; the reply carries X-DLP-Flags with the category names that matched.
  • Block: the request stops with 400 dlp_blocked before any provider is called. Nothing is sent and nothing is billed.

In report mode the first 512 KB of the request body is scanned; a block-mode rule scans the whole body before anything is sent. The matched value itself never appears in the reply, in the console or in a log: only the category name and a count.

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 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.

Where are chats in the browser stored?

Conversations on the One AI API Key chat are stored only in your browser, in IndexedDB, 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.

How long does the gateway keep my data?

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. One AI API Key does not train models on your prompts or outputs and does not sell them.

↑ ↓ moveEnter openEsc close
New accounts$10 credit on sign-up
Claim $10 credit →