https://api.nozle.app/engine/api/v1
Reverse proxy routes that forward LLM requests to OpenAI or Anthropic and record their token usage as a usage event in your organization, signed with your own X-Nozle-Key. Use it when you cannot change your LLM client. When you can, prefer usage capture in the SDK: it works with any provider and keeps LLM traffic out of Nozle.
The usage event bills only when your plan has a metered Feature with the same code; see Set up AI token billing.
/api/v1/proxy/openai/v1/*
Proxies all requests tohttps://api.openai.com/v1/*. Usage is recorded for chat completions (including streams), the Responses API and embeddings.
Auth: X-Nozle-Key header (sk_ only)
Required headers:
Optional headers:
cURL
/api/v1/proxy/anthropic/v1/*
Proxies all requests tohttps://api.anthropic.com/v1/*.
Auth: X-Nozle-Key header (sk_ only)
Required headers:
Optional headers:
cURL
The proxy returns the provider’s response unchanged. Your customer’s API key is forwarded but never stored. Token usage is read from the response and recorded as a usage event in your organization, with the code from
X-Nozle-Feature-Code (default llm_tokens) and the external_subscription_id of the subscription it is billed to.Subscription
Engine finds the subscription to bill before it calls the provider. WithoutX-Nozle-Subscription, the customer must have exactly one active subscription. With it, that subscription must be an active subscription of the customer in your organization. Otherwise Engine answers 422 and the provider is not called:
How it works
- The path after
/proxy/openai/or/proxy/anthropic/is sent to the provider host unchanged, with the same method, query string, headers and body, except as noted below. - Engine removes
X-Nozle-Key,X-Nozle-Customer-Id,X-Nozle-Subscription,X-Nozle-FeatureandX-Nozle-Feature-Codebefore forwarding. All other headers, includingAuthorizationandx-api-key, are forwarded.Accept-Encodingis set toidentityso the usage can be read. - A chat completion stream (
"stream": trueto/chat/completions) is sent withstream_options.include_usage: true, because OpenAI leaves usage out of streams otherwise. - Streaming (
text/event-stream) responses are passed through as they arrive; usage is read from the stream as it passes. - Usage is recognised by the shape of the response: chat completions, the Responses API, and Anthropic messages, including cached input and cache writes.
- An event is recorded only for a successful response that reports more than zero tokens. It carries
external_customer_idand the resolvedexternal_subscription_id, so it is billed to that subscription. Itstransaction_idisllm-<format>-<response id>, so the same response is never billed twice. Its properties areprovider,provider_host,model,input_tokens(all input, including cached),output_tokens,latency_msand, when sent,feature. Recording runs in the background; a recording failure does not change the response.