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

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

ParameterTypeDescription
modelstringRequired. A GPT model ID
inputstring / arrayRequired. A string, or an array of messages (images supported)
instructionsstringSystem instructions
streambooleanStream the response, with events such as response.output_text.delta
max_output_tokensintegerMaximum tokens to generate
reasoningobjectReasoning depth, such as {"effort": "high"}
toolsarrayFunction tool definitions
textobjectOutput 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)
FlyRouter

One key, every top AI model