API reference

API overview

FlyRouter is compatible with the OpenAI, Anthropic and Gemini protocols. Requests and responses match each vendor's official API, so official SDKs only need a new base URL and API key.

Base URLs

ProtocolBase URLNotes
OpenAI compatiblehttps://api.flyrouter.ai/v1For the OpenAI SDK and most clients (includes /v1)
Anthropic nativehttps://api.flyrouter.aiThe Anthropic SDK and Claude Code append /v1/messages (no /v1)
Gemini nativehttps://api.flyrouter.aiThe Google Gen AI SDK appends /v1beta/models/... (no /v1)

Authentication

Every endpoint is authenticated with an API key. See Authentication:

  • OpenAI compatible: Authorization: Bearer sk-...
  • Anthropic native: x-api-key: sk-... (Authorization: Bearer also works), plus anthropic-version: 2023-06-01
  • Gemini native: Authorization: Bearer sk-... or x-goog-api-key: sk-...

Endpoints

OpenAI compatible

MethodPathDescription
POST/v1/chat/completionsChat completions, all text models
POST/v1/responsesResponses API, GPT models only
POST/v1/images/generationsGenerate images
POST/v1/images/editsEdit images
GET/v1/modelsList models

Anthropic native

MethodPathDescription
POST/v1/messagesMessages, recommended for Claude

Gemini native

MethodPathDescription
POST/v1beta/models/{model}:generateContentGenerate content
POST/v1beta/models/{model}:streamGenerateContentStream generated content

Platform

MethodPathDescription
GET/v1/dashboard/billing/subscriptionKey budget
GET/v1/dashboard/billing/usageKey spend

Choosing a protocol

  • Claude: use the Anthropic native protocol for the fullest support of prompt caching, reasoning and tool use.
  • GPT: Chat Completions or Responses both work; Responses is recommended for new projects.
  • Gemini: the Gemini native or OpenAI-compatible protocol both work.
  • Code or tools that only speak OpenAI: call any text model through the OpenAI-compatible protocol.

Errors and rate limits

Errors return the matching HTTP status code in the protocol's error format. When you send requests too quickly you get a 429; lower concurrency and retry with exponential backoff. See Errors and retries for every status code and retry advice.

FlyRouter

One key, every top AI model