> ## Documentation Index
> Fetch the complete documentation index at: https://tokonomics.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How the Tokonomics Proxy Works with Your LLM Provider

> Tokonomics is a transparent pass-through proxy between your app and any LLM provider, forwarding requests and streaming responses with under 1ms overhead.

Tokonomics sits between your application and any LLM provider as a transparent proxy. You change one URL in your existing code, and every request flows through Tokonomics on its way to the provider. Tokonomics records token counts, calculates costs, and forwards the response back to your app — all without buffering your data or altering the provider's output.

## The proxy URL pattern

Route your requests to Tokonomics by replacing the provider's base URL with:

```text theme={null}
https://tokonomics.ca/proxy/{provider}/{path}
```

Substitute `{provider}` with the appropriate slug and `{path}` with the same endpoint path you would have called directly on the provider.

| Provider      | Slug        | Upstream path example                      |
| ------------- | ----------- | ------------------------------------------ |
| OpenAI        | `openai`    | `chat/completions`                         |
| Anthropic     | `anthropic` | `messages`                                 |
| DeepSeek      | `deepseek`  | `chat/completions`                         |
| Google Gemini | `gemini`    | `v1beta/models/gemini-pro:generateContent` |
| Mistral       | `mistral`   | `chat/completions`                         |
| xAI           | `xai`       | `chat/completions`                         |
| Cohere        | `cohere`    | `chat`                                     |
| Groq          | `groq`      | `chat/completions`                         |
| Together AI   | `together`  | `chat/completions`                         |

For example, an OpenAI chat completion request that previously targeted `https://api.openai.com/v1/chat/completions` becomes `https://tokonomics.ca/proxy/openai/chat/completions`.

## Request pass-through

Tokonomics forwards your request body to the upstream provider exactly as you send it — no transformation, no reordering, no re-encoding. The only modification Tokonomics makes before forwarding is stripping the three metering headers it recognises:

* `X-Metering-Tags` — cost attribution tags
* `X-Feature-Name` — feature label shorthand
* `X-Tenant-ID` — per-customer identifier

These headers are consumed by Tokonomics for cost tracking and never reach the provider. Every other header, including your `Authorization` header, passes through unchanged.

## Streaming

Tokonomics supports streaming responses out of the box. When you set `"stream": true` in your request body, Tokonomics pipes each server-sent event directly back to your client as it arrives from the provider — there is no buffering or batching. The additional latency introduced by the proxy hop is under 1ms, so your users experience the same time-to-first-token as a direct provider call.

Token counts are extracted from the final `[DONE]` chunk or the `usage` field in the stream, depending on the provider's streaming format.

## Response headers

Every response Tokonomics returns includes the following additional headers alongside the provider's own headers:

| Header                  | Description                                                 |
| ----------------------- | ----------------------------------------------------------- |
| `X-Metering-Latency`    | Round-trip latency to the upstream provider in milliseconds |
| `X-RateLimit-Limit`     | Requests allowed per minute for your Tokonomics API key     |
| `X-RateLimit-Remaining` | Requests remaining in the current rate-limit window         |

You can log `X-Metering-Latency` in your own observability stack to track provider performance over time independently of Tokonomics analytics.

<Note>
  Your provider API key is attached to the request and sent directly to the provider over TLS. Tokonomics never stores your prompt content, completion text, or provider credentials — only token counts, costs, and the metadata you attach via metering headers.
</Note>

Ready to send your first proxied request? See the provider-specific quick-start guides:

* [OpenAI quick start](/guides/openai)
* [Anthropic quick start](/guides/anthropic)
