LLM Providers

Use 60+ AI providers with your Agents – AI SDK v6 compatible

PraisonAI TypeScript supports 60+ AI providers through AI SDK v6. Switch between providers by changing the llm parameter – all providers use the same unified API.

Diagram

Agent

LLM Provider

Response

Supported Providers (60+)

Core Providers

ProviderModel ExamplesModalitiesEnv Variable
OpenAIgpt-4o, gpt-4o-mini, gpt-5Chat, Embeddings, Image, AudioOPENAI_API_KEY
Anthropicclaude-sonnet-4, claude-3-5-sonnetChat, ImageANTHROPIC_API_KEY
Googlegemini-2.0-flash, gemini-1.5-proChat, Embeddings, Image, AudioGOOGLE_API_KEY
Google Vertexgemini-pro, palm-2Chat, Embeddings, ImageGOOGLE_APPLICATION_CREDENTIALS
Azure OpenAIgpt-4, gpt-35-turboChat, Embeddings, ImageAZURE_API_KEY
Amazon Bedrockclaude-3, titanChat, EmbeddingsAWS_ACCESS_KEY_ID

Inference Providers

ProviderModel ExamplesModalitiesEnv Variable
xAIgrok-4, grok-3-fastChat, ImageXAI_API_KEY
Groqllama-3.3-70b, mixtral-8x7bChatGROQ_API_KEY
Fireworksllama-v3, mixtralChat, EmbeddingsFIREWORKS_API_KEY
Together.aillama-3, mistral-7bChat, EmbeddingsTOGETHER_API_KEY
DeepInfrallama-3, mistralChat, EmbeddingsDEEPINFRA_API_KEY
Replicatellama, stable-diffusionChat, ImageREPLICATE_API_TOKEN
Basetencustom modelsChatBASETEN_API_KEY
Hugging FacevariousChat, EmbeddingsHUGGINGFACE_API_KEY

Model Providers

ProviderModel ExamplesModalitiesEnv Variable
Mistralmistral-large, mistral-mediumChat, EmbeddingsMISTRAL_API_KEY
Coherecommand-r, command-r-plusChat, EmbeddingsCOHERE_API_KEY
DeepSeekdeepseek-chat, deepseek-reasonerChatDEEPSEEK_API_KEY
Cerebrasllama3.1-8b, llama3.3-70bChatCEREBRAS_API_KEY
Perplexitypplx-7b, pplx-70bChatPERPLEXITY_API_KEY

Image Generation

ProviderModel ExamplesModalitiesEnv Variable
Falflux, stable-diffusionImageFAL_KEY
Black Forest LabsFLUX.1ImageBFL_API_KEY
Lumadream-machineImage, VideoLUMA_API_KEY

Audio/Speech Providers

ProviderModel ExamplesModalitiesEnv Variable
ElevenLabseleven_multilingual_v2SpeechELEVENLABS_API_KEY
AssemblyAItranscriptionAudioASSEMBLYAI_API_KEY
Deepgramnova-2Audio, SpeechDEEPGRAM_API_KEY
GladiatranscriptionAudioGLADIA_API_KEY
LMNTspeechSpeechLMNT_API_KEY
HumeemotionAudioHUME_API_KEY
Rev.aitranscriptionAudioREVAI_API_KEY

Gateway/Proxy Providers

ProviderDescriptionEnv Variable
AI GatewayUnified gatewayAI_GATEWAY_API_KEY
OpenRouterMulti-provider routingOPENROUTER_API_KEY
PortkeyAI gatewayPORTKEY_API_KEY
HeliconeObservability proxyHELICONE_API_KEY
Cloudflare Workers AIEdge inferenceCLOUDFLARE_API_TOKEN

Local/Self-hosted

ProviderDescriptionEnv Variable
OllamaLocal modelsOLLAMA_BASE_URL
LM StudioLocal inferenceLM_STUDIO_BASE_URL
NVIDIA NIMEnterprise localNVIDIA_API_KEY (also NVIDIA_NIM_API_KEY, NVIDIA_NIM_API_BASE)
OpenAI CompatibleAny OpenAI-compatible APIOPENAI_COMPATIBLE_API_KEY

Regional/Specialized

ProviderDescriptionEnv Variable
Qwen (Alibaba)Chinese LLMDASHSCOPE_API_KEY
Zhipu AIGLM modelsZHIPU_API_KEY
MiniMaxChinese providerMINIMAX_API_KEY
Spark (iFlytek)Chinese providerSPARK_API_KEY
SambaNovaEnterpriseSAMBANOVA_API_KEY

Embedding Specialists

ProviderDescriptionEnv Variable
Voyage AIHigh-quality embeddingsVOYAGE_API_KEY
Jina AIEmbeddings & searchJINA_API_KEY
MixedbreadEmbeddingsMIXEDBREAD_API_KEY

Memory/Agent Providers

ProviderDescriptionEnv Variable
Mem0Memory layerMEM0_API_KEY
LettaAgent memoryLETTA_API_KEY

Enterprise/Cloud

ProviderDescriptionEnv Variable
Azure AIAzure servicesAZURE_API_KEY
SAP AI CoreSAP integrationSAP_AI_CORE_KEY
HerokuHeroku AIHEROKU_API_KEY
Anthropic VertexClaude via VertexGOOGLE_APPLICATION_CREDENTIALS

Quick Start

  1. Simple Usage
    typescript
    import { Agent } from 'praisonai';
    
    const agent = new Agent({
      instructions: 'You are helpful.',
      llm: 'gpt-4o-mini'
    });
    
    await agent.chat('Hello');
  2. With Configuration
    typescript
    import { Agent } from 'praisonai';
    
    const agent = new Agent({
      instructions: 'You are helpful.',
      llm: 'anthropic/claude-sonnet-4',
      verbose: true
    });

Provider Support Matrix

tools, outputSchema, and stream work on every supported provider:

Featureopenai/...anthropic/...google/...groq/...mistral/...ollama/...Other AI SDK providers
tools✅✅✅✅✅✅✅
outputSchema✅ (native)✅✅✅✅✅✅
stream✅✅✅✅✅✅✅
Tools + outputSchema together✅✅✅✅✅✅✅

On OpenAI, outputSchema uses response_format: json_schema; on other providers it routes through the AI SDK backend’s generateObject({ schema }). Both paths return a JSON string that matches the schema.

Agent with Different Models

Tools & Structured Output on any provider

typescript
import { Agent } from 'praisonai';

const getWeather = (city: string) => `Weather in ${city}: 20C, sunny`;

const agent = new Agent({
  instructions: 'Report the weather using the tool.',
  llm: 'anthropic/claude-3-5-sonnet-latest',
  tools: [getWeather],
});

await agent.start('Weather in Paris?');
typescript
import { Agent } from 'praisonai';

// OpenAI (default)
const openaiAgent = new Agent({
  instructions: 'You are helpful.',
  llm: 'gpt-4o-mini'
});

// Anthropic Claude
const claudeAgent = new Agent({
  instructions: 'You are helpful.',
  llm: 'anthropic/claude-3-5-sonnet'
});

// Google Gemini
const geminiAgent = new Agent({
  instructions: 'You are helpful.',
  llm: 'google/gemini-2.0-flash'
});

// All work the same way
await openaiAgent.chat('Hello!');
await claudeAgent.chat('Hello!');
await geminiAgent.chat('Hello!');

Multi-Agent with Mixed Providers

Use different models for different Agent roles:

typescript
import { Agent, AgentTeam } from 'praisonai';

// Fast model for quick tasks
const triageAgent = new Agent({
  name: 'Triage',
  instructions: 'Quickly categorize incoming requests.',
  llm: 'gpt-4o-mini'  // Fast and cheap
});

// Powerful model for complex reasoning
const analysisAgent = new Agent({
  name: 'Analyst',
  instructions: 'Perform deep analysis of complex problems.',
  llm: 'anthropic/claude-sonnet-4'  // Best reasoning
});

// Creative model for content
const writerAgent = new Agent({
  name: 'Writer',
  instructions: 'Write engaging content.',
  llm: 'gpt-4o'  // Good for creative tasks
});

const agents = new AgentTeam([triageAgent, analysisAgent, writerAgent]);
await agents.start();

Agent Model Selection by Task

typescript
import { Agent } from 'praisonai';

function createAgentForTask(taskType: string) {
  const modelMap: Record<string, string> = {
    'quick': 'gpt-4o-mini',
    'reasoning': 'anthropic/claude-sonnet-4',
    'creative': 'gpt-4o',
    'code': 'anthropic/claude-3-5-sonnet',
    'multimodal': 'google/gemini-2.0-flash'
  };

  return new Agent({
    instructions: `You handle ${taskType} tasks.`,
    llm: modelMap[taskType] || 'gpt-4o-mini'
  });
}

const codeAgent = createAgentForTask('code');
await codeAgent.chat('Write a function to sort an array');

Agent with Streaming

typescript
import { Agent } from 'praisonai';

const agent = new Agent({
  instructions: 'You tell stories.',
  llm: 'gpt-4o',
  stream: true  // Enable streaming
});

// Response streams to console
await agent.chat('Tell me a short story about a robot');

Environment-Based Model Selection

typescript
import { Agent } from 'praisonai';

// Model from environment variable
const agent = new Agent({
  instructions: 'You are helpful.',
  llm: process.env.PRAISONAI_MODEL || 'gpt-4o-mini'
});

// Or use different models per environment
const model = process.env.NODE_ENV === 'production' 
  ? 'gpt-4o'           // Better quality in prod
  : 'gpt-4o-mini';     // Cheaper in dev

const prodAgent = new Agent({
  instructions: 'You are helpful.',
  llm: model
});

Model String Formats

PraisonAI resolves the vendor from your model string — a bare claude- or gemini- name routes to Anthropic or Google without a prefix.

You writeResolves toNotes
gpt-4o-miniOpenAIDefault for anything not recognised
claude-3-5-sonnet-latestAnthropicBare prefix inference — no anthropic/ required
gemini-2.0-flashGoogleBare prefix inference — no google/ required
openai/gpt-4oOpenAIExplicit prefix (wins over baseURL)
anthropic/claude-3-5-sonnet-latestAnthropicExplicit prefix (wins over baseURL)
google/gemini-2.0-flashGoogleExplicit prefix (wins over baseURL)
groq/llama-3.3-70b-versatileGroqExplicit prefix (required — llama-* is not inferred)

When no llm is set

With no llm set on the Agent, the default model follows the first API key found in the environment, in the order declared by PROVIDER_DEFAULT_MODELS in src/llm/default-model.ts (kept byte-identical to the Python SDK). Final fallback: gpt-4o-mini. OPENAI_MODEL_NAME or PRAISONAI_MODEL, if set, always wins.

First key foundDefault model
OPENAI_API_KEYgpt-4o-mini
ANTHROPIC_API_KEYanthropic/claude-3-5-sonnet-latest
GEMINI_API_KEYgemini/gemini-1.5-flash
GOOGLE_API_KEYgoogle/gemini-1.5-flash
GROQ_API_KEYgroq/llama-3.3-70b-versatile
COHERE_API_KEYcohere/command-r
OLLAMA_HOSTollama/llama3.2
_(none)_gpt-4o-mini
typescript
import { Agent } from 'praisonai';

// Only ANTHROPIC_API_KEY is set → uses anthropic/claude-3-5-sonnet-latest
const agent = new Agent({ instructions: 'You are a helpful assistant' });

Prefix Inference vs Aliases

Two different mechanisms decide where a model string goes.

Prefix inference — the parser reads a bare name and infers the provider:

Bare prefixInferred provider
claude-*anthropic
gemini-*google
gpt-*openai

Convenience aliases — short names used only inside the provider-registry lookup:

AliasProvider
oaiopenai
grokxai
vertexgoogle-vertex
aws, bedrockamazon-bedrock
togethertogetherai
flux, bflblack-forest-labs
local, ollamaollama
nim, nvidianvidia-nim

Per-agent API key and baseURL

Pass credentials per agent — as of PraisonAI PR #4483 the constructor-time apiKey is honoured across providers, not only for OpenAI. Env vars remain a fallback.

typescript
import { Agent } from 'praisonai';

const agent = new Agent({
  instructions: 'You are helpful.',
  llm: 'claude-3-5-sonnet-latest',
  apiKey: process.env.MY_ANTHROPIC_KEY,          // no ANTHROPIC_API_KEY needed
  baseURL: 'https://gateway.example.com/v1',      // optional, per-agent
});

OpenAI-Compatible Providers

Use any OpenAI-compatible API:

typescript
import { Agent } from 'praisonai';

// Local LM Studio
const lmStudioAgent = new Agent({
  instructions: 'You are helpful.',
  llm: 'openai-compatible/local-model',
  llmConfig: {
    baseUrl: 'http://localhost:1234/v1',
    apiKey: 'not-needed'
  }
});

// Custom OpenAI-compatible endpoint
const customAgent = new Agent({
  instructions: 'You are helpful.',
  llm: 'openai-compatible/my-model',
  llmConfig: {
    baseUrl: process.env.CUSTOM_API_BASE,
    apiKey: process.env.CUSTOM_API_KEY
  }
});

Local Providers (Ollama, LM Studio)

typescript
import { Agent } from 'praisonai';

// Ollama (local)
const ollamaAgent = new Agent({
  instructions: 'You are helpful.',
  llm: 'ollama/llama3.2',
  llmConfig: {
    baseUrl: 'http://localhost:11434'
  }
});

// LM Studio
const lmStudioAgent = new Agent({
  instructions: 'You are helpful.',
  llm: 'lm-studio/local-model',
  llmConfig: {
    baseUrl: 'http://localhost:1234/v1'
  }
});

// NVIDIA NIM
const nimAgent = new Agent({
  instructions: 'You are helpful.',
  llm: 'nvidia/nemotron-super'
});

Agent with Custom Provider Config

For advanced use cases:

typescript
import { Agent, createProvider } from 'praisonai';

// Create custom provider with options
const customProvider = createProvider('openai/gpt-4o', {
  maxRetries: 3,
  timeout: 60000
});

// Use in Agent (advanced)
const agent = new Agent({
  instructions: 'You are helpful.',
  llm: 'gpt-4o'  // Simple string is usually sufficient
});

await agent.chat('Hello!');

Custom Provider Extension

Register your own provider:

typescript
import { registerProvider, BaseProvider } from 'praisonai';

class MyCustomProvider extends BaseProvider {
  async generateText(options) {
    // Your implementation
    return { text: 'response', usage: { totalTokens: 10 } };
  }
}

// Register globally
registerProvider('my-provider', MyCustomProvider);

// Use in Agent
const agent = new Agent({
  instructions: 'You are helpful.',
  llm: 'my-provider/my-model'
});

ProviderConfig Options

Custom transport and browser support are configurable on ProviderConfig.

OptionTypeDefaultDescription
fetchtypeof fetchundefinedCustom fetch — lets a host route egress through native code (e.g. a Tauri command). Implies dangerouslyAllowBrowser.
dangerouslyAllowBrowserbooleanauto-detectedForce-enable the OpenAI SDK’s browser guard. Auto-true in browser-like runtimes.

See Browser & Webview Runtimes for when to use each option.

Environment Variables

bash
# Core providers
export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...
export GOOGLE_API_KEY=AIza...

# Inference providers
export XAI_API_KEY=xai-...
export GROQ_API_KEY=gsk_...
export TOGETHER_API_KEY=...
export FIREWORKS_API_KEY=...

# Local providers
export OLLAMA_BASE_URL=http://localhost:11434
export LM_STUDIO_BASE_URL=http://localhost:1234/v1

# Set default model
export PRAISONAI_MODEL=openai/gpt-4o-mini

Related