API reference
Responses
POST https://api.flyrouter.ai/v1/responses
OpenAI's newer API that unifies text, tool use and reasoning, and the one new tools like Codex are built on. It supports GPT models only; calling Claude or Gemini through it returns a 400.
Example request
Terminal
curl https://api.flyrouter.ai/v1/responses \
-H "Authorization: Bearer $FLYROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.1-sol",
"instructions": "You are a concise assistant.",
"input": "Explain what a Transformer is in three sentences"
}'Common parameters
| Parameter | Type | Description |
|---|---|---|
model | string | Required. A GPT model ID |
input | string / array | Required. A string, or an array of messages (images supported) |
instructions | string | System instructions |
stream | boolean | Stream the response, with events such as response.output_text.delta |
max_output_tokens | integer | Maximum tokens to generate |
reasoning | object | Reasoning depth, such as {"effort": "high"} |
tools | array | Function tool definitions |
text | object | Output format, such as {"format": {"type": "json_schema", ...}} |
Response
The reply text is in the message item of the output array; the SDKs expose all of it as output_text. Usage is in usage: input_tokens, output_tokens, plus input_tokens_details.cached_tokens and output_tokens_details.reasoning_tokens.
json
{
"id": "resp_...",
"object": "response",
"model": "gpt-6.1-sol",
"status": "completed",
"output": [
{
"type": "message",
"role": "assistant",
"content": [{ "type": "output_text", "text": "A Transformer is..." }]
}
],
"usage": { "input_tokens": 32, "output_tokens": 120, "total_tokens": 152 }
}Multi-turn conversations
Append the previous turn's output to the next request's input array to keep the full context:
multi_turn.py
history = [{"role": "user", "content": "Recommend a beginner book on machine learning"}]
first = client.responses.create(model="gpt-6.1-sol", input=history)
history += first.output
history.append({"role": "user", "content": "Is there a free online version?"})
second = client.responses.create(model="gpt-6.1-sol", input=history)
print(second.output_text)