API reference

Chat Completions

POST https://api.flyrouter.ai/v1/chat/completions

The OpenAI-compatible chat completions endpoint. It can call every text model (Claude, GPT, Gemini, Grok, DeepSeek and more), with requests and responses in exactly OpenAI's format.

Example request

curl https://api.flyrouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $FLYROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6.1-sol",
    "messages": [
      {"role": "system", "content": "You are a concise assistant."},
      {"role": "user", "content": "What is a vector database?"}
    ],
    "max_tokens": 1024
  }'

Request parameters

ParameterTypeDescription
modelstringRequired. Model ID; see Models
messagesarrayRequired. Conversation messages with role of system, user, assistant or tool
streambooleanStream the response; see Streaming
stream_optionsobjectWith streaming, {"include_usage": true} returns usage in the last chunk
max_tokens / max_completion_tokensintegerMaximum tokens to generate
temperature / top_pnumberSampling parameters. Some newer models (such as newer Claude and reasoning models) don't support them and may reject or ignore them
stopstring / arrayStop generating at these strings
tools / tool_choicearray / stringTool calling
response_formatobjectStructured output
reasoning_effortstringGPT reasoning depth: low, medium, high; see Reasoning

Message content can be a string or an array of content blocks (text and image_url images); see Vision.

Response

json
{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1761800000,
  "model": "gpt-6.1-sol",
  "choices": [
    {
      "index": 0,
      "message": { "role": "assistant", "content": "A vector database is..." },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 26,
    "completion_tokens": 182,
    "total_tokens": 208,
    "prompt_tokens_details": { "cached_tokens": 0 }
  }
}

Common finish_reason values: stop (finished normally), length (cut off at max_tokens) and tool_calls (the model wants to call a tool).

Calling Claude through Chat Completions

It works, but it's best for simple chat. Claude-specific features such as prompt caching and reasoning may be unavailable or weaker in the OpenAI format. If you need them, use Messages instead.

FlyRouter

One key, every top AI model