Skip to content
Robotadocs

Providers Reference

Every chat provider implements the same IAIProvider interface from @robota-sdk/agent-core. You can pass any of them to Robota, createQuery() or createAgentRuntime(), and the calling code does not change.

Swap with zero code changes. The only thing you change when switching providers is which provider object you construct and pass in. All agent logic, tools, and session handling remain identical.


Provider Overview

Each provider is a protocol client, not a model-vendor lock: it speaks an API surface, and any endpoint speaking that surface works via baseURL — AI gateways (Vercel AI Gateway, LiteLLM, OpenRouter), Azure, vLLM, Ollama, LM Studio. Model slugs pass through verbatim, so routing anthropic/claude-* or meta-llama/* through an OpenAI-protocol gateway is a one-line config.

ProviderImport pathAPI surface it speaksAuth method
OpenAI@robota-sdk/agent-provider/openaiOpenAI API — official or ANY compatible endpoint (gateways, Azure, vLLM, local)OPENAI_API_KEY (or gateway key)
OpenRouterBuilt-in service using @robota-sdk/agent-provider/openaiOpenAI-compatible Chat CompletionsBrowser connection, API key, or OPENROUTER_API_KEY
Anthropic@robota-sdk/agent-provider/anthropicAnthropic Messages APIANTHROPIC_API_KEY
Gemini@robota-sdk/agent-provider/geminiGoogle GenAI APIGEMINI_API_KEY
DeepSeek@robota-sdk/agent-provider/deepseekOpenAI-compatible (DeepSeek endpoint default)DEEPSEEK_API_KEY
Qwen (Alibaba)@robota-sdk/agent-provider/qwenOpenAI-compatible (DashScope endpoint default)DASHSCOPE_API_KEY
Gemma / OpenAI-compatible@robota-sdk/agent-provider/gemmaOpenAI-compatible (bring your own endpoint)none for local servers

AI gateways (Vercel AI Gateway, LiteLLM, OpenRouter): Use the OpenAIProvider with the gateway's baseURL and a gateway model slug — see Through an AI gateway.

Local models (Ollama, LM Studio, llama.cpp): Use the GemmaProvider with a custom baseURL. See Local LLM Setup for a step-by-step guide.


Browser hosts

A platform-neutral provider entry does not guarantee that every client configuration works in a browser. The OpenAI and Anthropic SDK clients created by Robota from an apiKey reject browser page use by default. Both providers also accept an injected client or executor; the host must choose a suitable way to reach the service and protect credentials. A server-side proxy can keep provider credentials on the server. Endpoint CORS and authentication still apply. The OpenRouter browser connection below authorizes the Node-hosted CLI or App; it does not run the provider client in the browser.

Connect OpenRouter in the CLI or App

Choose OpenRouter during setup, or run /provider add openrouter in a session. Select Browser to approve the connection on OpenRouter. Robota receives a local callback, exchanges the authorization code for an API key, and saves the connection automatically. Choose the model after connecting; the default is anthropic/claude-sonnet-4.6.

API key is available in the same setup. Use it in a pure terminal, SSH session or container where the browser cannot reach Robota's local callback. You can also configure an environment reference:

robota --configure-provider router --type openrouter \
  --model anthropic/claude-sonnet-4.6 --api-key-env OPENROUTER_API_KEY --set-current

Browser-issued and newly entered keys stay in the host credential store; settings retain a reference. Environment references remain supported. Both methods use the same OpenRouter service and inference endpoint, and existing OpenAI-compatible gateway profiles continue to work.

The browser callback requires Robota and the browser on the same host. Cancellation or failure lets you retry or choose API key. Connecting does not verify model access or account credits and does not send a paid inference request. OpenRouter's API key page lets you manage keys issued during an interrupted setup.


Anthropic

Claude models. Best for long-context tasks, code generation, and nuanced reasoning.

Install

npm install @robota-sdk/agent-provider @anthropic-ai/sdk

@anthropic-ai/sdk is an optional peer dependency of @robota-sdk/agent-provider; install it next to the package, and import the Anthropic client from it only if you build the client yourself (below).

Basic usage

import { AnthropicProvider } from '@robota-sdk/agent-provider/anthropic';
 
const provider = new AnthropicProvider({
  apiKey: process.env.ANTHROPIC_API_KEY!,
});

Configuration options

OptionTypeRequiredDescription
apiKeystringYes (unless client or executor provided)Anthropic API key
clientAnthropicNoPre-built Anthropic SDK client
baseURLstringNoAny Anthropic-Messages-API-compatible endpoint (proxy/gateway)
timeoutnumberNoRequest timeout in milliseconds
defaultModelstringNoModel used when a request names none
executorIExecutorNoRemote or local executor override
enableWebToolsbooleanNoAttach Anthropic's server-side web_search tool to requests (default: off)

A provider profile sets the same thing with "options": { "nativeWebTools": { "webSearch": true } }; the CLI turns it on by default for an Anthropic or OpenAI profile that does not set nativeWebTools, wherever that provider can run it. A Gemini profile has to ask for it, because Google's terms attach conditions to showing and storing grounded results.

With a pre-built client

import Anthropic from '@anthropic-ai/sdk';
import { AnthropicProvider } from '@robota-sdk/agent-provider/anthropic';
 
const client = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,
  maxRetries: 3,
});
 
const provider = new AnthropicProvider({ client });

OpenAI

The OpenAI protocol client. Official OpenAI models (GPT and o-series) with native JSON mode, structured outputs, and the Responses API — and, via baseURL, any OpenAI-compatible endpoint: AI gateways, Azure OpenAI, vLLM, Ollama, LM Studio.

Install

npm install @robota-sdk/agent-provider openai

Basic usage

import { OpenAIProvider } from '@robota-sdk/agent-provider/openai';
 
const provider = new OpenAIProvider({
  apiKey: process.env.OPENAI_API_KEY!,
});

Configuration options

OptionTypeRequiredDescription
apiKeystringYes (unless client or executor provided)OpenAI API key
clientOpenAINoPre-built OpenAI SDK client
organizationstringNoOpenAI organization ID
baseURLstringNoAny OpenAI-compatible endpoint — gateways, Azure, vLLM, local
defaultModelstringNoModel used when a request names none
timeoutnumberNoRequest timeout in milliseconds
apiSurface'responses' | 'chat-completions'NoAPI surface (default: responses for OpenAI, chat-completions when baseURL is set)
responseFormat'text' | 'json_object' | 'json_schema'NoResponse format
jsonSchemaIOpenAIJsonSchemaDefinitionNoSchema for responseFormat: 'json_schema'
reasoningIOpenAIResponsesReasoningOptionsNoReasoning effort and summary for reasoning models (Responses API)
storebooleanNoWhether OpenAI stores Responses API results
includeEncryptedReasoningbooleanNoInclude encrypted reasoning items for stateless continuation
strictToolsbooleanNoStrict function-parameter validation (rewrites tool schemas for strict mode)
nativeWebToolsIOpenAINativeWebToolsOptionsNoHosted webSearch on OpenAI's own Responses API; true throws on a custom endpoint or Chat Completions
includeStreamUsagebooleanNoRequest token usage on streaming turns (default true; turn off for endpoints that reject it)
parallelToolCallsbooleanNoSends the boolean as parallel_tool_calls (Chat Completions: only on requests with tools); omitted by default; cannot be combined with executor
extraBodyTOpenAIExtraBodyNoJSON fields merged into every request body, for endpoint-specific options (a gateway's upstream settings); fields the provider manages are rejected; cannot be combined with executor
durableOperationsbooleanNoSends an Idempotency-Key header with a fresh ID on each model request, kept across the SDK's retries, for gateways that deduplicate requests
payloadLoggerIPayloadLoggerNoReceives a summary of each Chat Completions request (ConsolePayloadLogger in @robota-sdk/agent-provider/openai/loggers, FilePayloadLogger in @robota-sdk/agent-provider/openai/node)
executorIExecutorNoRemote or local executor override
loggerILoggerNoInternal logger (default: silent)

Through an AI gateway

Point baseURL at any OpenAI-compatible gateway and use the gateway's model slug — non-OpenAI models route through the same provider. Streaming and tool calling work unchanged; the slug is passed to the endpoint verbatim.

import { OpenAIProvider } from '@robota-sdk/agent-provider/openai';
 
// Vercel AI Gateway serving an Anthropic model
const provider = new OpenAIProvider({
  apiKey: process.env.AI_GATEWAY_API_KEY!,
  baseURL: 'https://ai-gateway.vercel.sh/v1',
  defaultModel: 'anthropic/claude-sonnet-4-5',
});

The same pattern covers LiteLLM (http://localhost:4000/v1), OpenRouter (https://openrouter.ai/api/v1), and Azure OpenAI deployments. Setting baseURL switches the default apiSurface to chat-completions for endpoint compatibility.

JSON output

import { OpenAIProvider } from '@robota-sdk/agent-provider/openai';
 
const provider = new OpenAIProvider({
  apiKey: process.env.OPENAI_API_KEY!,
  responseFormat: 'json_object',
});

o-series reasoning

import { OpenAIProvider } from '@robota-sdk/agent-provider/openai';
 
const provider = new OpenAIProvider({
  apiKey: process.env.OPENAI_API_KEY!,
  reasoning: { effort: 'high', summary: 'auto' },
});

Gemini

Google's Gemini models. Supports image generation, thinking mode, and native multimodal inputs.

Install

npm install @robota-sdk/agent-provider @google/genai

Basic usage

import { GeminiProvider } from '@robota-sdk/agent-provider/gemini';
 
const provider = new GeminiProvider({
  apiKey: process.env.GEMINI_API_KEY!,
});

Configuration options

OptionTypeRequiredDescription
apiKeystringYesGoogle AI API key
defaultModelstringNoModel used when a request names none
enableWebToolsbooleanNoAttach Google Search grounding (default: off); a profile sets nativeWebTools.webSearch
responseMimeType'text/plain' | 'application/json'NoResponse format
responseSchemaobjectNoSchema for JSON output
responseJsonSchemaobjectNoJSON Schema for structured output (instead of responseSchema)
thinkingConfigIGeminiThinkingConfigNoThinking mode settings
safetySettingsIGeminiSafetySetting[]NoPer-category safety thresholds
toolConfigobjectNoFunction-calling config passed to Gemini
defaultResponseModalitiesArray<'TEXT' | 'IMAGE'>NoDefault response modalities, e.g. text and image
imageCapableModelsstring[]NoModels allowed to return images; others are refused
executorIExecutorNoRemote or local executor override

Thinking mode

import { GeminiProvider } from '@robota-sdk/agent-provider/gemini';
import type { IGeminiThinkingConfig } from '@robota-sdk/agent-provider/gemini';
 
const thinkingConfig: IGeminiThinkingConfig = {
  includeThoughts: true,
  thinkingBudget: 8192,
};
 
const provider = new GeminiProvider({
  apiKey: process.env.GEMINI_API_KEY!,
  thinkingConfig,
});

DeepSeek

DeepSeek models including the R-series reasoning models. Uses the OpenAI-compatible API under the hood.

Install

npm install @robota-sdk/agent-provider openai

Basic usage

import { DeepSeekProvider } from '@robota-sdk/agent-provider/deepseek';
 
const provider = new DeepSeekProvider({
  apiKey: process.env.DEEPSEEK_API_KEY!,
});

Configuration options

OptionTypeRequiredDescription
apiKeystringYes (unless client or executor provided)DeepSeek API key
clientOpenAINoPre-built OpenAI SDK client pointed at DeepSeek
baseURLstringNoDefault: https://api.deepseek.com
defaultModelstringNoDefault: deepseek-v4-flash
thinking'enabled' | 'disabled'NoEnable extended thinking
reasoningEffort'low' | 'medium' | 'high' | 'xhigh' | 'max'NoReasoning depth
timeoutnumberNoRequest timeout in milliseconds
executorIExecutorNoRemote or local executor override
loggerILoggerNoInternal logger

Reasoning model with extended thinking

import { DeepSeekProvider } from '@robota-sdk/agent-provider/deepseek';
 
const provider = new DeepSeekProvider({
  apiKey: process.env.DEEPSEEK_API_KEY!,
  thinking: 'enabled',
  reasoningEffort: 'high',
});

Qwen (Alibaba Cloud)

Alibaba's Qwen models, accessed via DashScope. Supports built-in web search and web extraction tools.

Install

npm install @robota-sdk/agent-provider openai

Basic usage

import { QwenProvider } from '@robota-sdk/agent-provider/qwen';
 
const provider = new QwenProvider({
  apiKey: process.env.DASHSCOPE_API_KEY!,
});

Configuration options

OptionTypeRequiredDescription
apiKeystringYes (unless client or executor provided)DashScope API key
clientOpenAINoPre-built OpenAI SDK client pointed at DashScope
baseURLstringNoRegional endpoint (see below)
responsesBaseURLstringNoEndpoint for DashScope's Responses-compatible API
defaultModelstringNoDefault: qwen-plus
builtInWebToolsIQwenBuiltInWebToolsOptionsNoQwen-native web search / web fetch
timeoutnumberNoRequest timeout in milliseconds
executorIExecutorNoRemote or local executor override
loggerILoggerNoInternal logger

Regional endpoints

DashScope has region-specific endpoints. The default is Singapore (https://dashscope-intl.aliyuncs.com/compatible-mode/v1). QWEN_PROVIDER_BASE_URLS holds the endpoints for singapore, usVirginia, beijing and hongKong:

import { QwenProvider } from '@robota-sdk/agent-provider/qwen';
import { QWEN_PROVIDER_BASE_URLS } from '@robota-sdk/agent-provider/qwen';
 
const provider = new QwenProvider({
  apiKey: process.env.DASHSCOPE_API_KEY!,
  baseURL: QWEN_PROVIDER_BASE_URLS.usVirginia,
});

Native web tools

import { QwenProvider } from '@robota-sdk/agent-provider/qwen';
 
const provider = new QwenProvider({
  apiKey: process.env.DASHSCOPE_API_KEY!,
  builtInWebTools: { webSearch: true, webFetch: true },
});

Gemma / OpenAI-Compatible

A generic OpenAI-compatible provider. Use it for:

  • Ollama, LM Studio and the llama.cpp server (local)
  • Any other endpoint that implements the OpenAI Chat Completions API

In the robota CLI this is the provider type gemma, listed in setup as "Ollama / LM Studio / llama.cpp"; its setup defaults are LM Studio's http://localhost:1234/v1 and the model supergemma4-26b-uncensored-v2. When no server key is configured, the CLI gives the client library the placeholder key lm-studio.

Install

npm install @robota-sdk/agent-provider openai

Basic usage

import { GemmaProvider } from '@robota-sdk/agent-provider/gemma';
 
const provider = new GemmaProvider({
  apiKey: 'any-value', // many local servers do not validate this
  baseURL: 'http://localhost:11434/v1', // Ollama default
  defaultModel: 'llama3.2',
});

Configuration options

OptionTypeRequiredDescription
apiKeystringYes (unless client or executor provided)API key; most local servers do not validate it, so any non-empty placeholder works
baseURLstringNoServer URL including /v1 path
defaultModelstringNoModel name as recognised by the server
timeoutnumberNoRequest timeout in milliseconds
clientOpenAINoPre-built OpenAI SDK client
executorIExecutorNoRemote or local executor override
loggerILoggerNoInternal logger

LM Studio

import { GemmaProvider } from '@robota-sdk/agent-provider/gemma';
 
const provider = new GemmaProvider({
  apiKey: 'lm-studio',
  baseURL: 'http://localhost:1234/v1',
  defaultModel: 'gemma-3-12b', // the model name LM Studio shows for the loaded model
});

See the Local LLM Setup guide for Ollama, LM Studio, and llama.cpp configuration details.


Other provider packages

  • @robota-sdk/agent-provider/bytedance — BytedanceProvider, a video-generation provider for ByteDance ModelArk (Seedance). It implements IVideoGenerationProvider (createVideo, getVideoJob, cancelVideoJob) rather than the chat IAIProvider, so it is not an agent's chat model.
  • @robota-sdk/agent-provider/openai-compatible — the shared OpenAI-compatible protocol layer (message and tool conversion, request building, response parsing, stream assembly) that openai, deepseek, qwen and gemma build on. Use it to write a provider for your own OpenAI-compatible endpoint.
  • @robota-sdk/agent-provider/builtin — createDefaultProviderDefinitions(), the provider definitions (setup steps, defaults, model catalogs) the robota CLI offers for anthropic, openai, gemini, gemma, qwen, deepseek and openrouter, and createDefaultMediaProviderDefinitions() for the Gemini image and Seedance video providers. Use it when your own host wants the same settings-driven provider selection. It imports every provider subpath, so install all three vendor SDKs next to it.

Switching Providers

Because all providers implement IAIProvider, switching is a one-line change:

import { ConversationAgent } from '@robota-sdk/agent-core';
import { AnthropicProvider } from '@robota-sdk/agent-provider/anthropic';
import { OpenAIProvider } from '@robota-sdk/agent-provider/openai';
import { GeminiProvider } from '@robota-sdk/agent-provider/gemini';
 
// Register multiple providers — agent picks the right one from defaultModel.provider
const agent = new ConversationAgent({
  name: 'MultiProviderAgent',
  aiProviders: [
    new AnthropicProvider({ apiKey: process.env.ANTHROPIC_API_KEY! }),
    new OpenAIProvider({ apiKey: process.env.OPENAI_API_KEY! }),
    new GeminiProvider({ apiKey: process.env.GEMINI_API_KEY! }),
  ],
  defaultModel: {
    provider: 'anthropic',
    model: 'claude-sonnet-4-6',
  },
  systemMessage: 'You are a helpful assistant.',
});
 
// Use default provider
const r1 = await agent.run('Summarise this document.');
 
// Switch provider and model at runtime — no other code changes needed
agent.setModel({ provider: 'openai', model: 'gpt-4o' });
const r2 = await agent.run('Now translate that summary to French.');
 
// Switch to Gemini
agent.setModel({ provider: 'gemini', model: 'gemini-2.0-flash' });
const r3 = await agent.run('Rate the translation quality.');

With createQuery and createAgentRuntime, pass a different provider object at construction time, together with a model it serves.