Skip to main content

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.
  1. 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).
  2. Enable Models: Ensure the models you want to call are enabled in Team Settings > Models.
  3. Authenticate Requests: Pass your API key in Authorization: Bearer YOUR_API_KEY (standard for OpenAI SDKs) or X-API-Key: YOUR_API_KEY.
For interactive endpoint schemas, visit connect.omnifact.ai/docs.

Available Models

GET /v1/gateway/models

Example response:

EU-Hosted Model IDs (eu/)

  • /v1/gateway/models returns both direct model IDs (for example, gpt-6.1-terra or claude-sonnet-5-5 when US providers are enabled) and EU-prefixed IDs (for example, eu/gpt-6.1-terra on Microsoft Azure EU or eu/claude-sonnet-5-5 on 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.

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:
  1. Send tool definitions: Pass up to 128 function definitions in tools (type: "function") alongside your user message, with optional tool_choice ("auto", "none", "required", or a specific function).
  2. Execute tool calls: When finish_reason is "tool_calls", inspect message.tool_calls (or streamed delta.tool_calls).
  3. Return tool results: Append the full assistant message (both content and tool_calls) followed by one { "role": "tool", "tool_call_id": "...", "content": "..." } message per tool call.
  • 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, when tools are present and reasoning_effort is omitted, the AI Gateway automatically sets reasoning_effort: "none" so tool calls succeed seamlessly (explicitly passing a non-none reasoning_effort alongside tools returns 400 unsupported_value). Note that gpt-6.1-sol (and eu/gpt-6.1-sol) only supports tools on the Responses API and rejects tools on Chat Completions with 400 unsupported_value (param: "tools").
  • Anthropic (Claude): Claude may return preamble text in content alongside tool_calls. Always echo the complete assistant message (content and tool_calls) on the next turn.
  • Google Gemini: The gateway generates deterministic tool_call_id values (for example, call_get_weather_0), echo them verbatim. Passing parallel_tool_calls alongside tools on Gemini returns 400 unsupported_value.
  • Multiple tool results & follow-up turns: Consecutive role: "tool" messages are automatically batched for Anthropic and Gemini, and tool_choice / parallel_tool_calls are automatically stripped on turns where tools is omitted.

Request and Response Constraints

  • Messages: The final message must have role user or tool. system and developer roles are permitted only at the start of messages.
  • Content: String, array of { type: "text", text: "..." } parts (up to 256 parts, flattened up to 200,000 combined characters per message), or null on assistant messages with tool_calls.
  • Size & String Limits:
    • Total JSON request body: up to 1 MB
    • Messages per request: up to 1,024 (200,000 characters per message)
    • Tools per request: up to 128 (tools[].function.description and response_format.json_schema.description each support up to 200,000 characters for rich agent prompts)
    • model, tool_call_id, tools[].function.name, and response_format.json_schema.name: up to 128 characters
    • stop: Non-empty string or array of up to 4 strings (up to 256 characters each)
  • Parameters:
    • temperature: 0 to 2 (scaled to each provider’s native range; unsupported models return 400 unsupported_value).
    • top_p: 0 to 1.
    • max_completion_tokens (or max_tokens): max_completion_tokens takes precedence when both are sent.
    • reasoning_effort: none, minimal, low, medium, high, or xhigh (supported on OpenAI / Azure OpenAI reasoning models; returns 400 unsupported_value elsewhere).
    • response_format: text, json_object, or json_schema (json_schema is supported on OpenAI and OpenAI EU models; returns 400 unsupported_value on 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) return 400 Bad Request with param rather 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).
Credit Enforcement: Unlike the Chat UI, the AI Gateway has no Base-tier fallback when monthly organization credits reach zero: requests to all platform-managed models (including Base-tier models) are blocked with 402 Payment Required (insufficient_quota) until credits reset or increase, while custom self-hosted provider models (Providers) remain available.

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_unavailable or model_temporarily_unavailable).

FAQ

No. Requests to /v1/gateway/* pass directly to the configured model provider without Privacy Filter masking.
Every chat model currently enabled for your organization in Team Settings > Models.
Currently, each organization has a single API key managed and rotatable in Developer Tools.