Skip to main content
Many LLM providers expose an OpenAI-compatible Chat Completions API. Agentium lets you connect to any of them by simply providing a baseURL and apiKey — no custom provider code required. This works for providers like Together AI, Groq, Fireworks, OpenRouter, NVIDIA, DeepInfra, Cerebras, SambaNova, LM Studio, vLLM, and any other service that implements the OpenAI format.

Two Ways to Connect

Option 1: openai() Factory with Custom baseURL

The simplest approach — use the existing openai() factory:
This works because these providers use the same API format as OpenAI.

Option 2: OpenAICompatibleProvider Class

For more control or when building reusable providers, use the class directly:

Provider Examples

Together AI

Access 100+ open-source models including Llama, Mistral, Qwen, and more.
Environment:

Groq

Ultra-fast inference for open models.
Environment:

Fireworks AI

Optimized inference for open-source models.
Environment:

OpenRouter

Access models from multiple providers through a single API.
Environment:

NVIDIA NIM

NVIDIA-hosted inference for optimized models.
Environment:

DeepInfra

Serverless inference at low cost.
Environment:

LM Studio (Local)

Connect to a locally-running LM Studio server.

vLLM (Self-Hosted)

Connect to a self-hosted vLLM server.

Tool Calling

Tool calling works with any OpenAI-compatible provider that supports function calling:
Not all models or providers support tool calling. Check your provider’s documentation for function calling support. Larger models (70B+) generally have better tool calling reliability.

Registering a Custom Provider

If you use a specific endpoint frequently, register it as a named provider:

Supported Provider Endpoints

If the gateway is proxying GPT-5.4+ / GPT-5.6 / GPT-6 with tools, Chat Completions 400s unless reasoning_effort is "none". Agentium tries /v1/responses first (LiteLLM and recent OpenRouter expose it) and otherwise forces reasoning_effort: "none" so function tools still work. See Reasoning.

Full Example


Cross-References