Skip to Content
Gateway

Respan params

Fields you send with a gateway request to tag its session, user, and properties, and to cap each user's spend.

Respan params are fields you send next to the standard request body. The gateway reads them, removes them, and never sends them to the provider. Use them to say which session and user the request belongs to, and which properties you want to filter by in Logs.

Terminal
curl https://gateway.respan.ai/chat/completions \ -H "Authorization: Bearer $RESPAN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.5", "messages": [{"role": "user", "content": "Hello!"}], "session_identifier": "chat_7f3a", "customer_identifier": "user_8842", "metadata": {"feature": "support-chat"} }'

Sessions

session_identifier groups the turns of one conversation into a session. Use the id your app already has, such as a chat id. thread_identifier, the old name, still works, and session_identifier wins when a request sends both.

If you have no id, send "is_auto_session_enabled": true and Respan finds the session for you:

  • A request joins the session it continues: its messages are an earlier request’s messages plus that request’s reply, from the same customer_identifier, less than an hour before. Otherwise it starts a new session.
  • On Responses requests, previous_response_id or conversation also joins the request to the session of the response it continues.
  • It works on Chat Completions, Anthropic Messages and Responses requests. A response served from the gateway cache isn’t given a session.

See Sessions for how to find them in Logs.

Customers

customer_identifier attributes the request to one of your end users. Respan keeps a record per customer with their requests, tokens, and cost, and the gateway enforces a budget and a rate limit for each one before any provider is called. Use a stable ID that doesn’t reveal who the user is, such as a hashed user ID. customer_params adds details:

JSON
{ "customer_params": { "customer_identifier": "user_8842", "name": "Maya Patel", "email": "maya@example.com", "rate_limit": 60 } }
  • A customer is created the first time Respan sees its identifier, cut to 254 characters. Production and test API keys keep separate records.
  • customer_params.customer_identifier wins over a top-level customer_identifier.
  • name and email are saved only the first time the customer is seen. Edit them on the customer record after that.

Budgets

A budget caps what one customer can spend in a period. Go to Observability › Users & identifiers, click the customer, and under Budgets edit Period budget. Or set period_budget and budget_duration (daily, weekly, or monthly) with Update a user. Budget fields sent on a request are ignored, so a client can’t raise its own budget.

Once the customer’s spend in the period passes the budget, their requests get 402 until the next period, and Respan sends a customer_budget_limit_reached webhook. Spend is counted when a call ends, so the call that crosses the budget completes.

Rate limit

The default for every customer is Customer rate limit (requests/min) on the Limits tab. customer_params.rate_limit replaces it for one request. It applies to Chat Completions, and a customer over it gets 429 rate_limit_exceeded.

Analytics

Observability › Users & identifiers lists each customer with their requests, tokens, and cost. Click one for their metrics and budget, or Open in Logs for their requests. To read customers from code, use List users. If you also trace your app with the Respan SDK, tag spans with the same identifier. See Custom attributes.

Metadata

metadata holds any number of key-value pairs, shown on the log as custom properties:

JSON
{ "metadata": {"feature": "support", "region": "us-east", "customer_tier": "pro"} }

See Custom attributes to group and filter by them.

All params

ParameterTypeDefaultDescription
session_identifierstringNoneThe session (conversation) the request belongs to.
is_auto_session_enabledbooleanfalsetrue with no session id: Respan finds the session the conversation continues, or starts one.
thread_identifierstringNoneOld name for session_identifier. Used when no session_identifier is sent.
customer_identifierstringNoneThe end user the request belongs to. Drives per-customer analytics, budgets, and rate limits.
customer_paramsobjectNonecustomer_identifier plus name, email, and rate_limit.
metadataobjectNoneYour own key-value pairs, shown as custom properties. Values are stored as strings.
disable_logbooleanfalsetrue keeps the input and output out of the log. Tokens, cost, and latency are still recorded.
customer_credentialsobjectNoneYour provider keys for this request, keyed by provider. Never sent on to the provider as a param.
credential_overrideobjectNoneA provider key for one model, keyed by model.

Request headers that act like params:

HeaderDescription
X-Data-Respan-ParamsRespan params as base64-encoded JSON, for when you can’t change the body.
X-Respan-Managed-Fallback-Enabledtrue lets a call that your own key’s provider rate limited (429) retry on Respan’s key. See Managed fallback.
X-Respan-Betaenv-scoped-integrations-2026-03-28 scopes the request to the provider keys saved for its API key’s environment. See BYOK.

The OpenAI fields the gateway reads are listed in Chat Completions.

How to send them

Use whichever fits your client. You can combine them.

WhereHowUse when
Top level of the body"customer_identifier": "user_8842"; with the OpenAI SDK, in extra_body (Python) or as extra fields (TypeScript)You build the request yourself
respan_params object"respan_params": {"customer_identifier": "user_8842"}You want Respan’s fields kept apart from the provider’s
X-Data-Respan-Params headerBase64-encoded JSON objectYou can’t change the body, for example in a CLI or a third-party SDK
metadata.respan_paramsInside the request’s own metadataAnthropic Messages, Responses, and Gemini requests

Header. Encode a JSON object as base64:

Terminal
PARAMS=$(echo -n '{"customer_identifier":"user_8842","metadata":{"feature":"support-chat"}}' | base64 | tr -d '\n') curl https://gateway.respan.ai/chat/completions \ -H "Authorization: Bearer $RESPAN_API_KEY" \ -H "Content-Type: application/json" \ -H "X-Data-Respan-Params: $PARAMS" \ -d '{"model": "gpt-5.5", "messages": [{"role": "user", "content": "Hello!"}]}'

If the header isn’t valid base64, isn’t valid JSON, or doesn’t decode to an object, the whole header is ignored. The request is still served, and its log carries a header_parsing_error warning. The header is also how a realtime session names its customer and disable_log.

Anthropic Messages and other provider formats. On /v1/messages, /v1/responses, and the Gemini routes, you can put the params in metadata.respan_params. The gateway removes them before the provider sees the body, as in the Anthropic SDK tab above. With the Gemini SDK, a top-level respan_params sent through extra_body works too, as in the Gemini SDK tab.

On Chat Completions, metadata holds your custom properties, so a respan_params key inside it isn’t read there. Use respan_params at the top level or extra_body.

Precedence. When the same field arrives more than one way, respan_params wins over the header, and both win over a top-level field. The legacy names keywordsai_params and X-Data-Keywordsai-Params still work.

respan_params must be a JSON object wherever you send it. Any other value, such as a list, a number, or a string, is ignored without an error, and none of its params apply: the request isn’t attributed to the customer, budgets and rate limits don’t apply, and a disable_log inside it is ignored, so the request is logged in full. A top-level respan_params string that decodes to an object is the one exception, for multipart uploads where a form field can’t hold an object. The OpenAI SDK types metadata as strings, so don’t json.dumps the params into it; send an object through extra_body.

disable_log

"disable_log": true keeps the request’s input and output out of the log. The log still records the model, tokens, cost, latency, status, and your other params, so usage and billing stay complete.

To keep the content of every request out of the log, turn it on for the whole organization instead: go to Settings › General › Data retention and turn on Disable logging. It’s available on Team and above. See Data retention and ZDR.

Find them in Logs

Open Logs, click a request, and open the Metadata tab. Properties shows the customer and session, and Custom properties lists your metadata keys.

A span's Metadata tab in Logs: Properties with Customer ID, Customer name, Customer email, Thread ID, and Custom ID, and Custom properties with feature, environment, and customer_tier

Hover Customer ID or Session ID and click the filter icon to show only the requests with that value.

Environment scoping

Send X-Respan-Beta: env-scoped-integrations-2026-03-28 to scope a request to the provider keys saved for its API key’s environment. See Bring your own key.