Skip to main content

LLM Providers

The library supports 15+ LLM providers with unified authentication and configuration. All providers work through the same API surface.

Supported Providers

API Key Providers

These providers use static API keys for authentication:
Models: GPT-4o, GPT-4o-mini, o1-preview, o1-mini, o3-miniAPI: openai-responses (Responses API)Features: Vision, reasoning, tool callingSetup:
Models: Claude 3.5 Sonnet, Claude 3.5 Haiku, Claude Sonnet 4API: anthropic-messages (Messages API)Features: Vision, thinking (Sonnet 4), tool calling, prompt cachingSetup:
For Claude Pro/Max subscribers, use OAuth (see OAuth section).
Models: Gemini 1.5 Pro, Gemini 1.5 Flash, Gemini 2.0 Flash, Gemini 2.5 FlashAPI: google-generative-ai (Generative AI API)Features: Vision, thinking, tool callingSetup:
Note: Google provider does not support function call streaming. You receive a single toolcall_delta event with complete arguments.
Models: Grok Beta, Grok Code Fast, Grok Vision BetaAPI: openai-completions (OpenAI-compatible)Features: Vision, reasoning, tool callingSetup:
Models: Llama 3.3 70B, Llama 3.1 70B, Mixtral 8x7B, GPT-OSS modelsAPI: openai-completions (OpenAI-compatible)Features: Extremely fast inference, tool callingSetup:
Models: Llama 3.3 70B, Llama 3.1 70B, GPT-OSS modelsAPI: openai-completions (OpenAI-compatible)Features: Fast inference, tool callingSetup:
Models: Mistral Large, Mistral Small, Codestral, PixtralAPI: openai-completions (OpenAI-compatible)Features: Vision (Pixtral), tool callingSetup:
Note: Mistral requires tool call IDs to be exactly 9 alphanumeric characters. The library handles this automatically.
Models: Access to 100+ models from multiple providersAPI: openai-completions (OpenAI-compatible)Features: Multi-provider routing, fallback supportSetup:
Models: Claude models via AWS BedrockAPI: bedrock-converse-stream (Bedrock Converse API)Features: Vision, tool calling, AWS authenticationSetup: Uses AWS SDK credentials (IAM roles, profiles, or environment variables)
Models: MiniMax models (Chinese provider)API: openai-completions (OpenAI-compatible)Setup:
Models: Moonshot AI models with Anthropic-compatible APIAPI: openai-completions (OpenAI-compatible)Setup:
Models: Multi-provider gateway with caching and analyticsAPI: openai-completions (OpenAI-compatible)Setup:
Models: GPT-4o, GPT-4o-mini via AzureAPI: azure-openai-responses (Responses API)Setup:

OAuth Providers

These providers require OAuth authentication:
Models: GPT-5 Mini, GPT-5 Nano, GPT-5.1 Omni (ChatGPT Plus/Pro subscription)API: openai-codex-responses (Codex Responses API)Features: Extended reasoning, session-based caching, WebSocket supportSetup: See OAuth Authentication
Models: GPT-4o, Claude 3.5 Sonnet (Copilot subscription)API: openai-completions (OpenAI-compatible)Setup: See OAuth AuthenticationNote: If you get “model not supported” error, enable the model in VS Code Copilot Chat settings first.
Models: Gemini 2.0 Flash, Gemini 2.5 Flash (via Cloud Code Assist)API: google-gemini-cli (Cloud Code Assist API)Features: Free tier or paid subscription, thinking supportSetup: See OAuth Authentication
Models: Free Gemini 3, Claude, GPT-OSS models (via Google Cloud)API: openai-completions (OpenAI-compatible)Setup: See OAuth Authentication
Models: Gemini models via Google Cloud Vertex AIAPI: google-vertex (Vertex AI API)Setup: Uses Application Default Credentials (ADC)
See OAuth Authentication for details.

Environment Variables

In Node.js, API keys can be set via environment variables:

Checking API Keys

Browser Usage

In browsers, you must pass API keys explicitly:
Exposing API keys in frontend code is dangerous. Use a backend proxy for production applications.

Custom Models

Create custom models for local inference servers:

OpenAI Compatibility Settings

For OpenAI-compatible providers, you can override compatibility settings:
Available compatibility flags:
  • supportsStore - Whether provider supports the store field
  • supportsDeveloperRole - Whether provider supports developer role vs system
  • supportsReasoningEffort - Whether provider supports reasoning_effort
  • supportsUsageInStreaming - Whether provider supports token usage in streaming
  • maxTokensField - Use max_completion_tokens or max_tokens
  • requiresToolResultName - Whether tool results need the name field
  • requiresAssistantAfterToolResult - Whether assistant message is required after tool results
  • requiresThinkingAsText - Whether thinking blocks must be text with <thinking> tags
  • requiresMistralToolIds - Whether tool IDs must be Mistral format (9 alphanumeric chars)
  • thinkingFormat - Reasoning param format: openai, zai, or qwen
  • supportsStrictMode - Whether provider supports strict in tool definitions

Provider APIs

The library uses different APIs for different providers:
  • openai-completions - OpenAI Chat Completions API (xAI, Groq, Cerebras, Mistral, OpenRouter, etc.)
  • openai-responses - OpenAI Responses API (OpenAI)
  • openai-codex-responses - OpenAI Codex Responses API (OpenAI Codex)
  • azure-openai-responses - Azure OpenAI Responses API (Azure)
  • anthropic-messages - Anthropic Messages API (Anthropic)
  • google-generative-ai - Google Generative AI API (Google)
  • google-gemini-cli - Google Cloud Code Assist API (Google Gemini CLI)
  • google-vertex - Google Vertex AI API (Vertex AI)
  • bedrock-converse-stream - Amazon Bedrock Converse API (Bedrock)

Next Steps

OAuth Setup

Configure OAuth for subscription providers

Streaming

Learn about streaming events and responses