Skip to main content
Point existing OpenAI-compatible (and selected native) clients at NexLLM. Change two values — base URL and API key — and keep the provider request format you already use. Spend lands on your www.nexllm.ai wallet.

Introduction

NexLLM is an OpenAI-compatible AI gateway. The commercial path for apps, scripts, and IDE plugins is:
Authentication for standard OpenAI-shaped requests:
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 Anthropic base_url for 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.
See API Reference and Migrate from Vercel AI Gateway for Responses notes with the Vercel AI SDK.

Anthropic Messages (native)

NexLLM also accepts Anthropic’s Messages shape at POST /v1/messages. Pass your NexLLM key in x-api-key (and include anthropic-version), or use Bearer auth as documented in Authentication.

Images

Confirm an image-capable model ID with 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

Use the exact 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

Confirm Authorization: Bearer uses a NexLLM key (not an OpenAI or Vercel gateway key). Check expiry, IP allowlist, and whitespace. See Authentication.
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.
Top up the wallet and retry. Usage logs are under Usage.
Some models only support Chat Completions, Responses, or Messages. Inspect supported_endpoint_types on GET /v1/models before switching shapes.