Chat
Text, reasoning, images, documents, and audio with chat models from any provider.
Chat models answer messages that can carry text, images, documents, and audio. Send them in any chat format, such as https://gateway.respan.ai/v1/chat/completions, and the gateway translates the request for whichever provider serves the model. See All API formats.
Quickstart
curl https://gateway.respan.ai/v1/chat/completions \
-H "Authorization: Bearer $RESPAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-5.5", "messages": [{"role": "user", "content": "Write a haiku about latency."}]}'Fields, streaming, structured outputs, and tool calling are on the format pages, such as Chat Completions. Respan parameters work as on any request: see Respan parameters.
Models and providers
Every chat model in the catalog works, from any provider, in any chat format: change model to switch. The OpenAI SDK can call a Claude or Gemini model, and the Anthropic SDK can call a GPT model. To pin one provider, prefix the model ID, as in azure/gpt-5.5. See Providers.
Not every model reads every input. Each model in the model catalog lists what it accepts in input_modalities (text, image, audio, video, file), so filter on image for vision or file for documents.
When a request carries a field the target provider has no equivalent for, the gateway answers 400 and names the field instead of dropping it.
Reasoning
reasoning_effort is mapped across providers where the target has an equivalent:
| OpenAI Chat | Anthropic | Gemini |
|---|---|---|
reasoning_effort: "none" | thinking disabled | thinkingBudget: 0 |
reasoning_effort minimal to high | output_config.effort | thinkingLevel |
A token budget can’t be expressed in Chat Completions. To set one, use Anthropic Messages with thinking.budget_tokens.
Images and files
Add images and documents as content parts in a user message, in OpenAI’s format. The gateway maps them to Anthropic image and document blocks and to Gemini inline data, so one request works for all three.
response = client.chat.completions.create(
model="gpt-5.5",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What is the total on this receipt?"},
{"type": "image_url", "image_url": {"url": "https://example.com/receipt.png"}},
],
}],
)| Part | Takes | Notes |
|---|---|---|
image_url | A public URL or a base64 data URL (data:image/png;base64,...) | Add more parts for more images. |
file | A base64 data URL in file_data, application/pdf or text/plain | filename is optional. A provider’s own file_id works only on that provider. |
Base64 makes the body about a third larger than the file, so prefer URLs for large images.
Audio
Audio chat models, such as gpt-audio and gpt-audio-mini, take audio in a message and can answer in audio. Send an input_audio part (base64 only), and ask for a spoken answer with modalities and audio:
response = client.chat.completions.create(
model="gpt-audio",
modalities=["text", "audio"],
audio={"voice": "alloy", "format": "wav"},
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Answer the question in this recording."},
{"type": "input_audio", "input_audio": {"data": audio_base64, "format": "wav"}},
],
}],
)
print(response.choices[0].message.audio.transcript)The spoken answer is in choices[0].message.audio.data (base64). To turn text into speech or speech into text without a chat model, see Audio.
Pricing and logs
- Each request is one trace. Its root is a
chatrow, named by theX-Respan-Log-Idresponse header, with the messages (media parts included), the reply, tokens, latency, and cost. - On Respan’s credits, a call is charged from the provider’s usage report at the model’s catalog price. Images, documents, and audio are billed as input tokens. See Credits vs BYOK.
- On your own provider key, the provider bills you, and the call is still logged and counted against your limits.
- A streamed answer that reports no usage is charged its prompt and what it streamed.