Introduction
NexLLM is an OpenAI-compatible AI gateway. The commercial path for apps, scripts, and IDE plugins is:
Full field reference: API Reference. Agent-side tools instead of app code: MCP integration.
Model IDs are whatever
GET /v1/models returns for your API key (channel group + key restrictions). Examples in this page (gpt-4o, aws/claude-haiku-4-5) are illustrative — always confirm live IDs for your account.Prerequisites
- A NexLLM account and API key (Getting your API keys)
- Wallet balance for paid calls (Wallet)
- Any client that accepts a configurable OpenAI
base_url/baseURL, or Anthropicbase_urlfor Messages
OpenAI Chat Completions
Quick start (cURL)
OpenAI Python SDK
OpenAI TypeScript / Node SDK
Streaming
Set"stream": true (or stream: true in the SDK). The SSE shape matches OpenAI Chat Completions (choices[0].delta.content, ending with data: [DONE]).
OpenAI Responses
Use when your stack targets/v1/responses instead of Chat Completions. Confirm the model’s supported_endpoint_types via GET /v1/models first.
Anthropic Messages (native)
NexLLM also accepts Anthropic’s Messages shape atPOST /v1/messages. Pass your NexLLM key in x-api-key (and include anthropic-version), or use Bearer auth as documented in Authentication.
Images
GET /v1/models. Details: Image Generation API.
For Vercel AI SDK apps, chat uses @ai-sdk/openai against this same base URL; images can use the OpenAI SDK/HTTP path or @nexllm/ai-sdk-provider — see Vercel AI SDK.
Discover models for your key
data[].id values in later calls. Channel groups and key restrictions change the catalog — see Channel groups and Models API.
Key differences vs calling OpenAI directly
When to use Compatible APIs vs MCP vs Skills
Billing
Compatible API calls use standard gateway rates for the model and endpoint. There is no separate “compatible API” surcharge. See Pricing overview and Wallet.Troubleshooting
401 / authentication failed
401 / authentication failed
Confirm
Authorization: Bearer uses a NexLLM key (not an OpenAI or Vercel gateway key). Check expiry, IP allowlist, and whitespace. See Authentication.Model not found
Model not found
Call
GET /v1/models with the same key. Use the exact id. Check the key’s channel group and any model allowlist on the key.Wrong endpoint for this model
Wrong endpoint for this model
Some models only support Chat Completions, Responses, or Messages. Inspect
supported_endpoint_types on GET /v1/models before switching shapes.