Create a chat completion
Changed onSends a chat completion request through the Respan gateway with automatic logging. Accepts OpenAI chat completion parameters and Respan options for fallbacks, caching, and prompt management.
Pass Respan parameters in top-level body fields, under respan_params, or as base64-encoded JSON in the X-Data-Respan-Params header. If the same field is sent more than one way, respan_params takes precedence over the header, and both take precedence over a top-level field. The exception is variables: top-level variables are merged key by key over the variables from respan_params or the header. respan_params, keywordsai_params, and the decoded header must each be a JSON object; a top-level respan_params may also be a JSON string that decodes to one. Any other value is ignored, and so are the header's parameters: the request is served, but none of those parameters apply. Fields sent at the top level still apply. With the OpenAI SDK, use extra_body.
For legacy compatibility, keywordsai_params is merged into respan_params, and X-Data-Keywordsai-Params is still accepted and renamed internally.
Request
- Base URLhttps://api.respan.ai
- URLhttps://api.respan.ai/api/chat/completions
- AuthHTTP bearer
Headers
Base64-encoded JSON object of Respan parameters. Legacy X-Data-Keywordsai-Params is still accepted.
Pin the request to a specific provider without changing the model slug. Use the provider ID shown for that model in the model catalog.
Comma-separated beta feature flags. Available: token-breakdown-2026-03-26, env-scoped-integrations-2026-03-28
Request body
Example request
{
"model": "gpt-6-luna",
"messages": [
{
"role": "user",
"content": "Reply with exactly ok."
}
],
"max_tokens": 32,
"temperature": 0,
"reasoning_effort": "none"
}Response
Successful response for Create chat completion
Example response
{
"object": "chat.completion",
"choices": [
{
"message": {
"role": "assistant",
"content": "ok"
},
"finish_reason": "stop"
}
]
}Changes
- breaking
request body became required
- breaking
removed the media type
application/jsonfor the response with the status - breaking
the response property
/became nullable for the status - breaking
the response property
/became nullable for the status - breaking
the response property
/became nullable for the status - breaking
the response property
/became nullable for the status - breaking
the response property
/became nullable for the status - breaking
the response property
/became nullable for the status - info
api operation id
gateway_createChatCompletionremoved and replaced withcreateChatCompletion - info
api tag
Gatewayadded - info
api tag
gatewayremoved - info
the
request property default value[]was added - info
the
request property default value[]was added - info
the
request property default valuefalsewas added - info
the
request property default valuefalsewas added - info
the
request property default valuefalsewas added - info
the
request property format was generalized fromdoubleto no format - info
the
request property format was generalized fromdoubleto no format - info
the
request property format was generalized fromdoubleto no format - info
the
request property format was generalized fromdoubleto no format - info
the
request property format was generalized fromdoubleto no format - info
the
request property format was generalized fromdoubleto no format - info
the
request property format was generalized fromdoubleto no format - info
added the media type
text/event-streamfor the response with the status - info
removed
subschema #1subschema #2from the/response propertyoneOflist for the response status - info
removed
subschema #1subschema #2from the/response propertyoneOflist for the response status - info
removed
subschema #1subschema #2from the/response propertyoneOflist for the response status - info
removed
subschema #1subschema #2from the/response propertyoneOflist for the response status - info
removed
subschema #1subschema #2from the/response propertyoneOflist for the response status - info
removed
subschema #1subschema #2from the/response propertyoneOflist for the response status
- breaking
- info
added the non-success response with the status
- info
added the non-success response with the status
- info