Skip to content

LLM Providers

The Dispatcher supports 22 LLM providers out of the box. Each sovagent can be connected to a different provider and model, allowing you to run a fleet with mixed backends -- Claude for code review, GPT for general conversation, Gemini for long-context analysis, and Ollama for fully local inference.


Configuration

LLM provider settings can be specified at three levels (highest priority wins):

  1. Per-agent -- ~/.j41/dispatcher/agents/<id>/agent-config.json (mode 0600)
  2. Runtime env-var override -- J41_LLM_PROVIDER, J41_LLM_MODEL, J41_LLM_BASE_URL, J41_LLM_API_KEY
  3. Global config -- ~/.j41/dispatcher/config.toml ([llm] and [provider_keys])

The TOML file is the source of truth for global defaults. Env vars are intended for ops scenarios (CI, one-shot debugging) and override the matching TOML keys for the running process only. See Configuration for the full schema.

Global Default (config.toml)

toml
[llm]
provider = "anthropic"
model = "claude-sonnet-4-20250514"
base_url = ""

[provider_keys]
anthropic = "sk-ant-..."

The provider key under [provider_keys] is forwarded to job containers via docker run -e ANTHROPIC_API_KEY=… per job. It never enters the dispatcher's own process.env.

Runtime Env-Var Override

VariableTOML keyDescription
J41_LLM_PROVIDERllm.providerProvider name (see table below)
J41_LLM_MODELllm.modelModel name (uses provider default if omitted)
J41_LLM_BASE_URLllm.base_urlOverride the default API endpoint (useful for proxies, self-hosted, or Azure deployments)
J41_LLM_API_KEYllm.api_keyGeneric fallback API key. Prefer [provider_keys].<name> instead so the key stays out of the dispatcher's process.env.

Per-Agent Override

In ~/.j41/dispatcher/agents/<id>/agent-config.json (mode 0600):

json
{
  "executor": "local-llm",
  "llmProvider": "anthropic",
  "llmModel": "claude-sonnet-4-20250514",
  "llmApiKey": "sk-ant-..."
}

When the dispatcher spawns a job container for this agent, the per-agent values are injected via docker run -e. Per-agent files are mode 0600 because they can hold an API key; the dispatcher's own process never reads the key into its environment.


Supported Providers

Cloud Providers

#Provider IDProviderDefault ModelAuth
1anthropicAnthropicclaude-sonnet-4-20250514API key
2openaiOpenAIgpt-4oAPI key
3googleGoogle Geminigemini-2.5-proAPI key
4groqGroqllama-3.3-70b-versatileAPI key
5mistralMistral AImistral-large-latestAPI key
6cohereCoherecommand-r-plusAPI key
7togetherTogether AImeta-llama/Meta-Llama-3.1-70B-Instruct-TurboAPI key
8fireworksFireworks AIaccounts/fireworks/models/llama-v3p1-70b-instructAPI key
9perplexityPerplexityllama-3.1-sonar-large-128k-onlineAPI key
10deepseekDeepSeekdeepseek-chatAPI key
11xaixAI (Grok)grok-2API key
12sambanovaSambaNovaMeta-Llama-3.1-70B-InstructAPI key
13leptonLepton AIllama-3.1-70bAPI key
14anyscaleAnyscalemeta-llama/Meta-Llama-3.1-70B-InstructAPI key
15replicateReplicatemeta/meta-llama-3.1-405b-instructAPI token
16bedrockAWS Bedrockanthropic.claude-3-5-sonnet-20241022-v2:0AWS credentials
17azureAzure OpenAI(deployment name)API key + endpoint
18vertexGoogle Vertex AIgemini-2.5-proService account

Self-Hosted / Local Providers

#Provider IDProviderDefault ModelAuth
19ollamaOllamallama3.1None (local)
20llamacppllama.cpp(loaded model)None (local)
21vllmvLLM(loaded model)None or API key
22openai-compatibleAny OpenAI-compatible API(varies)API key

Provider Configuration Examples

Anthropic (Claude)

bash
export J41_LLM_PROVIDER="anthropic"
export J41_LLM_API_KEY="sk-ant-api03-..."
export J41_LLM_MODEL="claude-sonnet-4-20250514"

Available models: claude-opus-4-20250514, claude-sonnet-4-20250514, claude-haiku-3-20250514

OpenAI (GPT)

bash
export J41_LLM_PROVIDER="openai"
export J41_LLM_API_KEY="sk-proj-..."
export J41_LLM_MODEL="gpt-4o"

Available models: gpt-4o, gpt-4o-mini, gpt-4-turbo, o3, o3-mini

Google Gemini

bash
export J41_LLM_PROVIDER="google"
export J41_LLM_API_KEY="AIza..."
export J41_LLM_MODEL="gemini-2.5-pro"

Available models: gemini-2.5-pro, gemini-2.5-flash, gemini-2.0-flash

Groq

bash
export J41_LLM_PROVIDER="groq"
export J41_LLM_API_KEY="gsk_..."
export J41_LLM_MODEL="llama-3.3-70b-versatile"

Groq provides extremely fast inference. Ideal for sovagents where response latency matters more than model capability.

Mistral AI

bash
export J41_LLM_PROVIDER="mistral"
export J41_LLM_API_KEY="..."
export J41_LLM_MODEL="mistral-large-latest"

Available models: mistral-large-latest, mistral-medium-latest, mistral-small-latest, codestral-latest

DeepSeek

bash
export J41_LLM_PROVIDER="deepseek"
export J41_LLM_API_KEY="sk-..."
export J41_LLM_MODEL="deepseek-chat"

Available models: deepseek-chat, deepseek-reasoner

xAI (Grok)

bash
export J41_LLM_PROVIDER="xai"
export J41_LLM_API_KEY="xai-..."
export J41_LLM_MODEL="grok-2"

Ollama (Local)

bash
export J41_LLM_PROVIDER="ollama"
export J41_LLM_BASE_URL="http://localhost:11434"
export J41_LLM_MODEL="llama3.1"

No API key needed. Make sure Ollama is running and the model is pulled:

bash
ollama pull llama3.1
ollama serve

Ollama is ideal for fully sovereign operation where no data leaves your machine.

llama.cpp (Local)

bash
export J41_LLM_PROVIDER="llamacpp"
export J41_LLM_BASE_URL="http://localhost:8080"

Run the llama.cpp server first:

bash
./llama-server -m ./models/llama-3.1-70b.gguf --port 8080

vLLM (Local/Cluster)

bash
export J41_LLM_PROVIDER="vllm"
export J41_LLM_BASE_URL="http://localhost:8000"
export J41_LLM_MODEL="meta-llama/Meta-Llama-3.1-70B-Instruct"

AWS Bedrock

bash
export J41_LLM_PROVIDER="bedrock"
export J41_LLM_MODEL="anthropic.claude-3-5-sonnet-20241022-v2:0"
export AWS_REGION="us-east-1"
export AWS_ACCESS_KEY_ID="AKIA..."
export AWS_SECRET_ACCESS_KEY="..."

Bedrock uses standard AWS credential chain. IAM roles, instance profiles, and SSO are all supported.

Azure OpenAI

bash
export J41_LLM_PROVIDER="azure"
export J41_LLM_API_KEY="your-azure-key"
export J41_LLM_BASE_URL="https://your-resource.openai.azure.com"
export J41_LLM_MODEL="your-deployment-name"

The model for Azure is the deployment name, not the model name.

Google Vertex AI

bash
export J41_LLM_PROVIDER="vertex"
export J41_LLM_MODEL="gemini-2.5-pro"
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
export GOOGLE_CLOUD_PROJECT="your-project-id"
export GOOGLE_CLOUD_REGION="us-central1"

OpenAI-Compatible (Generic)

For any API that follows the OpenAI chat completions format:

bash
export J41_LLM_PROVIDER="openai-compatible"
export J41_LLM_BASE_URL="https://your-api.example.com/v1"
export J41_LLM_API_KEY="your-key"
export J41_LLM_MODEL="your-model"

This works with LiteLLM, LocalAI, OpenRouter, and similar proxies.


Model Parameters

Beyond the required settings, you can tune generation behavior per-agent:

json
{
  "executor": {
    "type": "local-llm",
    "provider": "anthropic",
    "model": "claude-sonnet-4-20250514",
    "temperature": 0.3,
    "maxTokens": 4096,
    "topP": 0.9,
    "frequencyPenalty": 0,
    "presencePenalty": 0,
    "stopSequences": []
  }
}
ParameterTypeDefaultDescription
temperaturenumber0.7Randomness (0 = deterministic, 2 = creative)
maxTokensnumber4096Maximum tokens per response
topPnumber1.0Nucleus sampling threshold
frequencyPenaltynumber0Reduce repetition (0-2)
presencePenaltynumber0Encourage topic diversity (0-2)
stopSequencesstring[][]Stop generation at these strings

Not all parameters are supported by every provider. Unsupported parameters are silently ignored.


Provider Selection Guide

Use caseRecommended ProviderWhy
Best overall qualityanthropic (Claude)Strong reasoning, instruction following, safety
Fastest response timegroqHardware-optimized inference
Lowest costdeepseek or ollamaDeepSeek is cheap; Ollama is free (local)
Full data sovereigntyollama or llamacppZero data leaves your machine
Long context (1M+)google (Gemini) or anthropic (Claude)Both support extended context windows
Code generationanthropic or deepseekStrong coding benchmarks
Enterprise compliancebedrock or azureSOC2, HIPAA, data residency controls

Switching Providers at Runtime

You can change a sovagent's LLM provider without restarting the Dispatcher:

bash
# Edit the agent's profile
j41-dispatch agent edit code-reviewer
# Change the executor provider/model
j41-dispatch agent reload code-reviewer

New jobs will use the updated provider. Active jobs continue with their original provider until completion.


Next Steps

  • Executors -- if you need more than direct LLM calls (webhooks, LangServe, LangGraph, A2A, MCP)
  • Agents -- per-agent configuration and SOUL.md files
  • Security -- network allowlists to control which LLM endpoints are reachable