Skip to main content

What is the API Gateway?

The Omnifact API Gateway provides a unified API to access models from leading AI providers through a single endpoint. It allows your developers and internal applications to route requests to powerful AI models directly, without needing to set up separate accounts with different AI providers. Key benefits include:
  • One key, multiple providers: Access models from OpenAI, Anthropic, Google, Mistral AI, and more with a single API key.
  • Drop-in replacement: Switch between providers and models with minimal code changes using existing OpenAI-compatible SDKs.
  • Unified billing & observability: Monitor your spending and usage across all providers in one place. No credit card needed for separate providers.
  • Runs on your existing budget: Consumes your organization’s existing AI budget, billed through your existing Omnifact contract.

Getting Started

The API Gateway is exclusively available for customers on the Enterprise Plan. See our Billing page or contact support to upgrade.
To start using the API Gateway, you need to enable API access and generate an API key.
  1. Prerequisites: Ensure that API Gateway access has been enabled for your organization by Omnifact. (Note: If this feature is not enabled for your organization, any requests to the API will return a 403 Forbidden error.)
  2. Opt-in: A team administrator must enable the Gateway in the Developer Tools section.
  3. Authentication: All requests to the API Gateway must include your API key (which can be generated in Team Settings > Developer Tools) in the x-api-key header (or as a Bearer token if using OpenAI SDKs).
For full API specifications, please refer to the live OpenAPI documentation.

Available Models

You can query the available models using the standard OpenAI models endpoint. For detailed specifications of the endpoint parameters and response formats, please refer to the OpenAI API Reference.

GET /v1/gateway/models

curl https://connect.omnifact.ai/v1/gateway/models \
  -H "Authorization: Bearer YOUR_API_KEY"
Example response:
{
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "created": 1715368132,
      "owned_by": "openai"
    },
    {
      "id": "claude-4-sonnet",
      "object": "model",
      "created": 1718841600,
      "owned_by": "anthropic"
    }
  ]
}

EU-Hosted Models

The API Gateway supports routing requests specifically to EU-hosted providers.
  • The /v1/gateway/models endpoint may return both standard model IDs (e.g., gpt-4o) and EU-specific model IDs (e.g., eu/gpt-4o).
  • To enforce routing to an EU backend, prefix the model ID with eu/ in your request. Standard model IDs will route to non-EU backends only.

Chat Completions

The API Gateway provides drop-in compatible APIs that let you switch providers by simply changing your base URL to https://connect.omnifact.ai/v1/gateway. No code rewrites are required. You can use the same SDKs and tools you already know.

POST /v1/gateway/chat/completions

This endpoint accepts the standard OpenAI-compatible format and supports streaming, routing, custom temperatures, and more. (Note: Tool calling and structured outputs are not supported in V1).
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://connect.omnifact.ai/v1/gateway',
  apiKey: 'YOUR_API_KEY', // typically process.env.OMNIFACT_API_KEY
});

async function main() {
  const response = await client.chat.completions.create({
    model: 'gpt-4o',
    messages: [{ role: 'user', content: 'Hello, how are you?' }],
    stream: true,
  });

  for await (const chunk of response) {
    process.stdout.write(chunk.choices[0]?.delta?.content || '');
  }
}

main();

Request and Response Constraints

While the API Gateway is OpenAI-compatible, it enforces the following constraints:
  • Messages: The last message in the array must have the user role. The system or developer roles are only permitted at the start of the message array. The developer role is supported.
  • Content: Message content can be a string or an array of { type: "text", text: "..." } objects (arrays are flattened).
  • Limits: A maximum of 1024 messages per request, and up to 200,000 characters per message.
  • Parameters: Supported parameters include temperature (0–2, scaled per provider; some models may reject it), max_completion_tokens (or max_tokens), stream, and stream_options.include_usage.
  • Response Model Field: The response returns the canonical model type, which may not necessarily match the requested ID (e.g., if you requested an eu/... prefixed model or an alias).

Usage & Billing

Using the API Gateway consumes your organization’s monthly AI budget. This means you don’t need to manage separate billing for API usage. Please note that API Gateway usage includes a markup on top of the base model costs.
Strict Credit Enforcement: Unlike the Chat UI (which falls back to base-tier models when credits are exhausted), the API Gateway strictly enforces credit limits. If your organization’s credits are exhausted, all API requests will be blocked until more credits are added or the billing cycle resets. Base-tier models are not available as a fallback when credits run out.
You can monitor your overall usage and credit consumption in the Billing & Usage dashboard.

Error Codes

In addition to standard HTTP errors, the API Gateway may return the following status codes:
  • 401 Unauthorized: Missing or invalid API key.
  • 402 Payment Required: No active subscription (subscription_required) or credits exhausted (insufficient_quota). An active subscription is validated on every chat completion request.
  • 403 Forbidden: API Gateway access is not enabled for your organization.
  • 404 Not Found: The requested model was not found or is disabled.
  • 429 Too Many Requests: Upstream provider rate limit reached.

FAQ

Not yet. Privacy Filter integration for the API Gateway is planned for a future update.
The available models depend on your organization’s specific Omnifact plan and configuration. You can use the /v1/gateway/models endpoint to see the exact list of models available to you. Base-tier models are available as long as you have credits, but they cannot be used as a fallback when credits are exhausted.
Currently, there is only one API key per organization, managed through the Developer Tools section.