API Reference
OpenAI-Compatible API
Call any model on FIM Gate using the unified OpenAI request format.
FIM Gate exposes an OpenAI-compatible interface for the vast majority of models: the request and response structures match the OpenAI API, so you only need to swap the base URL to FIM Gate and the same code can call GPT, Claude, Gemini, and models from other providers.
Connection details
| Item | Value |
|---|---|
| Base URL | https://api.gate.fim.ai/v1 |
| Authentication | Authorization: Bearer $FIM_API_KEY |
| Request format | JSON (Content-Type: application/json) |
Minimal example
curl https://api.gate.fim.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $FIM_API_KEY" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{"role": "user", "content": "Introduce yourself in one sentence"}
]
}'To switch models, just change the model field — for example to claude-sonnet-4-5 or gemini-2.5-pro — and the request structure stays the same.
Using the OpenAI SDK
Any OpenAI SDK that supports a custom base_url works out of the box:
from openai import OpenAI
client = OpenAI(
api_key="$FIM_API_KEY",
base_url="https://api.gate.fim.ai/v1",
)
resp = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.FIM_API_KEY,
baseURL: "https://api.gate.fim.ai/v1",
});
const resp = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);Included endpoints
| Endpoint | Method | Purpose | Docs |
|---|---|---|---|
/v1/chat/completions | POST | Multi-turn chat, multimodal input, tool calling, streaming | Chat Completions |
/v1/responses | POST | OpenAI's next-generation unified API with built-in tools and reasoning parameters | Responses |
Image and audio endpoints are also available:
/v1/images/generations— text-to-image, supportsdall-e-2,dall-e-3,gpt-image-1,gemini-2.5-flash-image,gemini-3-pro-image-preview,gemini-3.1-flash-image-preview; see Images API/v1/audio/speech— text-to-speech, supportstts-1,tts-1-hd,gpt-4o-mini-tts,gemini-2.5-flash-preview-tts,gemini-2.5-pro-preview-tts; see Audio API/v1/audio/transcriptions— speech-to-text, supportswhisper-1; see Audio API
Choosing between Chat Completions and Responses
- If you have existing code built on Chat Completions, or your third-party framework only supports that format: keep using
/v1/chat/completions. - If you need OpenAI's built-in tools (such as web search) or reasoning effort control: use
/v1/responses.
Both share the same API key and credit balance, so you can mix and match freely.