Skip to main content

Overview

The Omnifact provider connects to the Omnifact API Gateway — an OpenAI-compatible endpoint for chat completions. Use your Omnifact organization API key and any model enabled for your organization.

Installation

npm install @core-ai/omnifact

createOmnifact()

Create an Omnifact provider instance.
import { createOmnifact } from '@core-ai/omnifact';

const omnifact = createOmnifact({
  apiKey: process.env.OMNIFACT_API_KEY,
});

Options

apiKey
string
Your Omnifact organization API key.
baseURL
string
Custom gateway base URL. Defaults to https://connect.omnifact.ai/v1/gateway.

Returns

OmnifactProvider with method chatModel().

Model IDs

Use the exact id values returned by GET /v1/gateway/models. The SDK passes the model id through unchanged. EU-hosted backends (Azure OpenAI, Vertex Google, Vertex Anthropic, Mistral, etc.) always use the eu/ prefix:
  • eu/gpt-5-mini — Azure OpenAI
  • eu/claude-4-6-sonnet — Vertex Anthropic
  • eu/mistral-large — Mistral
Direct non-EU providers use the plain type id:
  • gpt-5-mini — OpenAI
  • claude-4-6-sonnet — Anthropic
When both a direct and an EU backend exist for the same model type, both ids may appear in the model list. Use the one that matches where you want the request routed.

Capabilities

FeatureSupport
Chat CompletionYes
StreamingYes
Function CallingNo
VisionNo
ReasoningDepends on model
EmbeddingsNo
Image GenerationNo

Examples

Basic chat

import { createOmnifact } from '@core-ai/omnifact';
import { generate } from '@core-ai/core-ai';

const omnifact = createOmnifact({
  apiKey: process.env.OMNIFACT_API_KEY,
});

// Use an id from GET /v1/gateway/models (eu/ prefix for EU-hosted models).
const model = omnifact.chatModel('eu/gpt-5-mini');

const result = await generate({
  model,
  messages: [{ role: 'user', content: 'Hello!' }],
});

console.log(result.content);

Streaming

import { createOmnifact } from '@core-ai/omnifact';
import { stream } from '@core-ai/core-ai';

const omnifact = createOmnifact({
  apiKey: process.env.OMNIFACT_API_KEY,
});

// Use an id from GET /v1/gateway/models (eu/ prefix for EU-hosted models).
const model = omnifact.chatModel('eu/gpt-5-mini');

const result = await stream({
  model,
  messages: [{ role: 'user', content: 'Count to five.' }],
});

for await (const chunk of result.textStream) {
  process.stdout.write(chunk);
}

Provider-specific options

The gateway follows the OpenAI Chat Completions API. Pass options via providerOptions.openai:
await generate({
  model: omnifact.chatModel('eu/gpt-5-mini'),
  messages: [{ role: 'user', content: 'Hello!' }],
  providerOptions: {
    openai: {
      temperature: 0.7,
    },
  },
});
See the OpenAI compat provider docs for available Chat Completions options.