API Overview
An overview of FIM Gate's endpoint families, authentication methods, and shared calling conventions.
FIM Gate is an LLM API aggregation and forwarding service: one API key, three interface styles, access to models from many providers. This page covers the endpoint families, authentication methods, and the conventions shared by all interfaces.
Endpoint families
| Interface style | Base URL | Auth header | Typical use case |
|---|---|---|---|
| OpenAI-compatible (recommended) | https://api.gate.fim.ai/v1 | Authorization: Bearer $FIM_API_KEY | Call the vast majority of models with a single OpenAI-format API, including streaming, multimodal input, and tool calling |
| Claude native | https://api.gate.fim.ai (endpoint /v1/messages) | x-api-key: $FIM_API_KEY | When request/response fields must match the Anthropic Messages API field for field |
| Gemini native | https://api.gate.fim.ai (endpoints /v1beta/...) | x-goog-api-key: $FIM_API_KEY | When request/response fields must match the Google Gemini API field for field; streaming uses ?alt=sse |
All three styles share the same account and the same credit balance — pick whichever fits. Unless you have a specific need for field-level compatibility, we recommend using the OpenAI-compatible interface throughout.
Authentication
Create an API key in the Console, then put it in the auth header for the interface style you're using. The key grants access to your account balance, so keep it in server-side environment variables only — never in frontend code or public repositories.
export FIM_API_KEY="sk-..."Documentation guide
OpenAI-compatible interface:
- OpenAI-Compatible API Overview
- Chat Completions —
POST /v1/chat/completions - Responses —
POST /v1/responses
Provider-native interfaces:
- Claude Native API —
POST /v1/messages - Gemini Native API —
POST /v1beta/models/{model}:generateContent
Beyond the chat endpoints above, FIM Gate also provides OpenAI-compatible image and audio endpoints:
- Images API —
POST /v1/images/generations - Audio API —
POST /v1/audio/speech,POST /v1/audio/transcriptions
Shared conventions
Request format
- All request bodies are JSON and must include
Content-Type: application/json. - The model is specified via the
modelfield in the request body (in the Gemini native style, the model name goes in the URL path). See gate.fim.ai/pricing for the live list of available models and prices.
Streaming
All three styles support Server-Sent Events (SSE) streaming:
- OpenAI-compatible: set
"stream": truein the request body - Claude native: set
"stream": truein the request body - Gemini native: use the
:streamGenerateContentmethod and append the query parameter?alt=sse
HTTP status codes
| Status code | Meaning | Suggested handling |
|---|---|---|
400 | Malformed request body or invalid parameters | Check the JSON structure and field values |
401 | API key missing or invalid | Check the header name and the key itself |
404 | Path not found | Check the base URL and endpoint spelling |
413 | Request body exceeds the size limit | Compress the input or split the request |
429 | Rate limit exceeded | Reduce request frequency and retry with exponential backoff |
500 | Gateway or upstream internal error | Retry later |
503 | Service temporarily unavailable | Upstream maintenance or overload — retry later |
The exact rate-limit thresholds depend on your account tier. When you receive a 429, reduce your request rate and retry with exponential backoff.
Billing
Usage is billed by each model's input/output token consumption; the usage field in every response reports what the request consumed. Per-model prices are listed at gate.fim.ai/pricing.