Skip to content
kazma.
ع Star 7 Get Started

LLM Providers

Kazma talks to LLMs over plain HTTP (no SDK lock-in). Most providers speak the OpenAI Chat Completions wire format and work through the generic LLMProvider with Authorization: Bearer. A few providers need a dedicated native class because their auth or request schema differs — those are called out below and dispatched in model_registry.py.

Configure providers in Web UI → Settings → Providers, or in kazma.yaml, or via environment variables. See Configuration → Provider presets.


TierHow it worksProviders
OpenAI-compatible (generic LLMProvider)One httpx client, Bearer auth, /v1/chat/completionsOpenAI, DeepSeek, Groq, xAI, OpenRouter, Mistral, Together, Cohere, Fireworks, Perplexity, AI21, NVIDIA NIM, Ollama, LM Studio, Custom
Native class (auth/schema differs)Dedicated provider class + a branch in model_registry.get_client()Anthropic, Azure, Bedrock, Google Gemini

The generic LLMProvider always sends Authorization: Bearer to /chat/completions. It cannot reach Anthropic-native (/messages), Azure (api-key header + api-version), or Bedrock (SigV4). Those need their native classes — adding one means a new class + a branch in all three client-building sites (get_client, get_model, get_client_by_provider), not just a preset entry.

Set KAZMA_LITELLM_URL (or llm.gateway.url) to send OpenAI-compatible calls through a LiteLLM proxy (spend, keys, fallbacks live in the proxy). This is not exclusive: Anthropic / Azure / Bedrock / Gemini stay native. Loopback Ollama / LM Studio stay direct unless KAZMA_LITELLM_LOCAL=1. KAZMA_LITELLM=0 disables the proxy. Kazma does not import litellm.

All work with a single API key env var (or configured in the UI). No code changes — just set the base URL + key.

Providerbase_urlEnv var
OpenAIhttps://api.openai.com/v1OPENAI_API_KEY
DeepSeekhttps://api.deepseek.com/v1DEEPSEEK_API_KEY
Groqhttps://api.groq.com/openai/v1GROQ_API_KEY
xAI / Grokhttps://api.x.ai/v1XAI_API_KEY
OpenRouterhttps://openrouter.ai/api/v1OPENROUTER_API_KEY
Mistralhttps://api.mistral.ai/v1MISTRAL_API_KEY
Together AIhttps://api.together.xyz/v1TOGETHER_API_KEY
Coherehttps://api.cohere.ai/v1COHERE_API_KEY
Fireworks AIhttps://api.fireworks.ai/inference/v1FIREWORKS_API_KEY
Perplexityhttps://api.perplexity.aiPERPLEXITY_API_KEY
AI21 Labshttps://api.ai21.com/studio/v1AI21_API_KEY
NVIDIA NIMhttps://integrate.api.nvidia.com/v1NVIDIA_API_KEY
Ollama (local)http://127.0.0.1:11434/v1(none)
LM Studio (local)http://localhost:1234/v1(none)
Custom(any)(any)

Local providers (Ollama/LM Studio) don’t need a real key — a dummy key is injected automatically.

Ollama discovery/health use the configured provider Base URL (fallback http://127.0.0.1:11434), so a server running in WSL/container can reach an Ollama daemon on another host by pointing the provider’s Base URL at it (e.g. the WSL gateway IP for a Windows-hosted Ollama — 127.0.0.1 inside WSL is the WSL VM, not Windows). The provider Test Connection button reports Cannot connect to <base_url> (connection failed) when the endpoint is unreachable.


Talks to the native /v1/messages endpoint with x-api-key + anthropic-version: 2023-06-01 headers. Translates OpenAI-format messages to the Anthropic schema (system is top-level, content is typed blocks, tool_use/tool_result blocks for tool calling).

Terminal window
export ANTHROPIC_API_KEY=sk-ant-...

Then select a Claude model in the UI or kazma.yaml. The registry auto-dispatches to AnthropicProvider when the active provider is anthropic. No proxy needed.

OpenAI-compatible payload but with Azure-specific routing: api-key header (not Bearer), deployment-scoped URL (.../openai/deployments/<deployment>/chat/completions), and a required api-version query parameter.

Terminal window
export AZURE_OPENAI_ENDPOINT=https://<resource>.openai.azure.com
export AZURE_OPENAI_API_KEY=<key>
export AZURE_OPENAI_DEPLOYMENT=<deployment-name>
export AZURE_OPENAI_API_VERSION=2024-10-21

Uses the Converse API for a uniform interface across Bedrock-hosted models (Claude, Llama, Mistral, …). Requests are SigV4-signed via the standard boto3 credential chain (env vars, shared-credentials file, or IAM role). Requires pip install boto3 — degrades with a clear message when absent.

Terminal window
export AWS_REGION=us-east-1
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
# optional: AWS_SESSION_TOKEN for temporary credentials

Model id examples: anthropic.claude-3-5-sonnet-20241022-v2:0, meta.llama3-1-70b-instruct-v1:0.

Vertex AI via Application Default Credentials (ADC). base_url is computed per project/location. Hardcoded model list: gemini-2.5-flash, gemini-2.5-pro, gemini-2.0-flash, gemini-2.0-flash-lite. See quickstart for ADC setup.


The registry auto-corrects provider/model mismatches: calling a model owned by a different provider than the active one switches both. Use Settings → Providers in the UI, /config model <name> (chat), or the Model selector in the sidebar. See AGENTS.md §1 for the model-registry invariants.