What is the AI Gateway?
The Omnifact AI Gateway provides a unified OpenAI-compatible API to call models enabled for your organization across multiple providers through a single endpoint and API key:- One key, multiple providers: Route requests to OpenAI, Anthropic, Google, Mistral AI, and EU cloud backends (
eu/...) without managing separate vendor keys. - Drop-in OpenAI SDK compatibility: Point standard OpenAI SDKs, coding agents, and internal apps at
https://connect.omnifact.ai/v1/gateway. - Unified billing: Consumes your organization’s shared monthly AI usage credits on Billing & Usage.
Getting Started
The AI Gateway is available on the Enterprise Plan. See Billing & Usage or contact support@omnifact.ai to upgrade.
- Enable API Access: Go to Team Settings > Developer Tools and switch on Enable API Access to generate your organization’s API key (no separate Gateway toggle is required).
- Enable Models: Ensure the models you want to call are enabled in Team Settings > Models.
- Authenticate Requests: Pass your API key in
Authorization: Bearer YOUR_API_KEY(standard for OpenAI SDKs) orX-API-Key: YOUR_API_KEY.
Available Models
GET /v1/gateway/models
EU-Hosted Model IDs (eu/)
/v1/gateway/modelsreturns both direct model IDs (for example,gpt-6.1-terraorclaude-sonnet-5-5when US providers are enabled) and EU-prefixed IDs (for example,eu/gpt-6.1-terraon Microsoft Azure EU oreu/claude-sonnet-5-5on Google Cloud EU).- Prefixing the model ID with
eu/guarantees routing to the EU-hosted backend; unprefixed US provider IDs route only to direct US providers.
Chat Completions
POST /v1/gateway/chat/completions
Supports streaming (stream: true), function tool calling (tools), structured outputs (response_format), reasoning effort (reasoning_effort), temperature, and stop sequences. Clients that automatically append /v1 to a base URL can also call /v1/gateway/v1/chat/completions and /v1/gateway/v1/models.
- Node.js (OpenAI SDK)
- Python (OpenAI SDK)
- cURL
Tool Calling (Function Calling)
The AI Gateway translates standard OpenAI function calling (tools, tool_choice, tool_calls, and role: "tool") across OpenAI, OpenAI (EU), Anthropic, Google Gemini, and Mistral AI automatically:
- Send tool definitions: Pass up to
128function definitions intools(type: "function") alongside yourusermessage, with optionaltool_choice("auto","none","required", or a specific function). - Execute tool calls: When
finish_reasonis"tool_calls", inspectmessage.tool_calls(or streameddelta.tool_calls). - Return tool results: Append the full assistant message (both
contentandtool_calls) followed by one{ "role": "tool", "tool_call_id": "...", "content": "..." }message per tool call.
Provider-specific tool calling behavior
Provider-specific tool calling behavior
- OpenAI GPT-5.6 & GPT-6 models (
gpt-6.1-terra,gpt-6-sol,gpt-6-luna): Because these models do not run extended reasoning alongside Chat Completions function tools, whentoolsare present andreasoning_effortis omitted, the AI Gateway automatically setsreasoning_effort: "none"so tool calls succeed seamlessly (explicitly passing a non-nonereasoning_effortalongsidetoolsreturns400 unsupported_value). Note thatgpt-6.1-sol(andeu/gpt-6.1-sol) only supports tools on the Responses API and rejectstoolson Chat Completions with400 unsupported_value(param: "tools"). - Anthropic (Claude): Claude may return preamble text in
contentalongsidetool_calls. Always echo the complete assistant message (contentandtool_calls) on the next turn. - Google Gemini: The gateway generates deterministic
tool_call_idvalues (for example,call_get_weather_0), echo them verbatim. Passingparallel_tool_callsalongsidetoolson Gemini returns400 unsupported_value. - Multiple tool results & follow-up turns: Consecutive
role: "tool"messages are automatically batched for Anthropic and Gemini, andtool_choice/parallel_tool_callsare automatically stripped on turns wheretoolsis omitted.
Request and Response Constraints
- Messages: The final message must have role
userortool.systemanddeveloperroles are permitted only at the start ofmessages. - Content: String, array of
{ type: "text", text: "..." }parts (up to256parts, flattened up to200,000combined characters per message), ornullonassistantmessages withtool_calls. - Size & String Limits:
- Total JSON request body: up to 1 MB
- Messages per request: up to 1,024 (
200,000characters per message) - Tools per request: up to 128 (
tools[].function.descriptionandresponse_format.json_schema.descriptioneach support up to 200,000 characters for rich agent prompts) model,tool_call_id,tools[].function.name, andresponse_format.json_schema.name: up to 128 charactersstop: Non-empty string or array of up to 4 strings (up to 256 characters each)
- Parameters:
temperature:0to2(scaled to each provider’s native range; unsupported models return400 unsupported_value).top_p:0to1.max_completion_tokens(ormax_tokens):max_completion_tokenstakes precedence when both are sent.reasoning_effort:none,minimal,low,medium,high, orxhigh(supported on OpenAI / Azure OpenAI reasoning models; returns400 unsupported_valueelsewhere).response_format:text,json_object, orjson_schema(json_schemais supported on OpenAI and OpenAI EU models; returns400 unsupported_valueon Anthropic and Gemini).stream&stream_options.include_usage: SSE streaming and final-chunk token usage reporting.
- Strict Parameter Validation: Unknown top-level fields (
presence_penalty,frequency_penalty,seed,n,logprobs, or image/audio content parts) return400 Bad Requestwithparamrather than being silently ignored.
Usage & Billing
AI Gateway usage draws from your organization’s shared monthly AI credit pool (with a gateway markup over base model rates).Error Codes
Errors return the OpenAI-compatible{ "error": { "message", "type", "code", "param" } } envelope:
400 Bad Request: Invalid message sequence, unknown parameter, context exceeded (context_length_exceeded), or unsupported model/provider parameter (unsupported_value).401 Unauthorized: Missing or invalid API key (invalid_api_key).402 Payment Required: Inactive subscription (subscription_required) or exhausted monthly credits (insufficient_quota).403 Forbidden: API key is not associated with an organization (organization_required).404 Not Found: Requested model does not exist or is disabled (model_not_found).429 Too Many Requests: Upstream provider rate limit reached (rate_limit_exceeded).500 Internal Server Error: Upstream provider terminated generation with an error (completion_failed).503 Service Unavailable: Upstream provider or model is temporarily unavailable (service_temporarily_unavailableormodel_temporarily_unavailable).
FAQ
Does the AI Gateway run the Privacy Filter?
Does the AI Gateway run the Privacy Filter?
No. Requests to
/v1/gateway/* pass directly to the configured model provider without Privacy Filter masking.Which models appear in /v1/gateway/models?
Which models appear in /v1/gateway/models?
Every chat model currently enabled for your organization in Team Settings > Models.
Can we create multiple API keys?
Can we create multiple API keys?
Currently, each organization has a single API key managed and rotatable in Developer Tools.