FIM Gate Docs
API Reference

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 styleBase URLAuth headerTypical use case
OpenAI-compatible (recommended)https://api.gate.fim.ai/v1Authorization: Bearer $FIM_API_KEYCall the vast majority of models with a single OpenAI-format API, including streaming, multimodal input, and tool calling
Claude nativehttps://api.gate.fim.ai (endpoint /v1/messages)x-api-key: $FIM_API_KEYWhen request/response fields must match the Anthropic Messages API field for field
Gemini nativehttps://api.gate.fim.ai (endpoints /v1beta/...)x-goog-api-key: $FIM_API_KEYWhen 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:

Provider-native interfaces:

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 model field 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": true in the request body
  • Claude native: set "stream": true in the request body
  • Gemini native: use the :streamGenerateContent method and append the query parameter ?alt=sse

HTTP status codes

Status codeMeaningSuggested handling
400Malformed request body or invalid parametersCheck the JSON structure and field values
401API key missing or invalidCheck the header name and the key itself
404Path not foundCheck the base URL and endpoint spelling
413Request body exceeds the size limitCompress the input or split the request
429Rate limit exceededReduce request frequency and retry with exponential backoff
500Gateway or upstream internal errorRetry later
503Service temporarily unavailableUpstream 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.