Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Use a Cloud Provider

Connect Zeph to Claude, OpenAI, Gemini, or any OpenAI-compatible API instead of local Ollama.

Breaking change (v0.17.0): The old [llm.cloud], [llm.orchestrator], and [llm.router] config sections have been removed. Run zeph --migrate-config to automatically convert your config file.

Claude

ZEPH_CLAUDE_API_KEY=sk-ant-... zeph

Or in config:

[llm]
[[llm.providers]]
type = "claude"
model = "claude-sonnet-5"
max_tokens = 4096
# server_compaction = true          # Server-side context compaction (Claude API beta)
# server_compaction_trigger_tokens = 140000  # optional; minimum 50000
# enable_extended_context = true    # lift the 200k window ceiling to the model's native window

Claude does not support embeddings. Use a multi-provider setup to combine Claude chat with Ollama embeddings, or use OpenAI embeddings.

Model Support

Zeph recognizes the Claude 5 family, including claude-fable-5-2 (Fable 5.2) and claude-mythos-5-2 (Mythos 5.2), with built-in pricing for cost tracking. Dated, Bedrock and Vertex style identifiers for these models resolve to the same capability set.

Fast Mode

Fast mode asks Claude for up to 2.5x faster output at twice the price. It is opt-in per provider entry:

[[llm.providers]]
type = "claude"
model = "claude-fable-5-2"
speed = "fast"          # default: "standard"

Fast mode is honored only by models that advertise it: Opus 5.5, Fable 5.2 and Mythos 5.2. On any other Claude model Zeph logs a warning and runs at standard speed. speed = "fast" on a non-Claude provider entry fails config validation. Cost tracking applies fast-mode pricing, and the TUI status bar shows a fast tag while the active provider runs in fast mode. The --init wizard asks for the speed when you pick a fast-capable model; --migrate-config adds the commented speed key to existing Claude entries.

For providers that run in a non-standard speed, /provider status shows Speed: configured X, last response Y, where Y is parsed from the response usage.speed (n/a before the first response). If Claude rejects the speed parameter with a 400, Zeph stops sending it for that provider (one-shot latch) and continues at standard speed. Background and ensemble calls are billed at the speed and model of the provider that served them.

The shipped defaults and zeph --init select claude-sonnet-5-5. If your config still names the retired claude-sonnet-4-5-20250929, Zeph logs a startup WARN naming the replacement, and zeph migrate-config --in-place rewrites the id for you.

A Claude 404 is reported as not_found_error: model: <id> (check the model id and account access) and is logged once.

Server-Side Compaction

Enable server_compaction = true to let the Claude API manage context length on the server side. When the context approaches the model’s limit, Claude produces a compact summary in-place. Zeph surfaces the compaction event in the TUI and via the server_compaction_events metric.

server_compaction_trigger_tokens sets the input-token count at which the API compacts. The API rejects values below 50 000, so Zeph rejects them when loading the config. When unset, the trigger is 70% of the model’s context window (140 000 at the default 200k window, never below 50 000), which stays below the point where the tool loop stops at 80% of the context budget. Zeph warns at startup when an explicit trigger is at or above that stop line.

Note: Server compaction needs a model that supports it (Claude 4.6 and later, including Haiku 5.5; not Haiku 4.5 or older generations). On an unsupported model Zeph emits a WARN and falls back to client-side compaction. If the API (or a proxy in front of it) rejects the compact-2026-01-12 beta header, Zeph disables server compaction for the rest of the session and retries once without it.

Extended Context Window

Current Claude models have a 1M-token native context window, but Zeph caps the window it plans against at 200k so budgets stay conservative. Set enable_extended_context = true to lift that cap to the model’s native window; the auto_budget feature scales accordingly. Models whose window is 200k regardless (Haiku 4.5) ignore the flag, and legacy Sonnet 4/4.5 additionally send the context-1m-2025-08-07 beta header. You can also raise the budget directly with memory.context_budget_tokens. Enable with the --extended-context CLI flag or in the provider entry in config.

Gemini

ZEPH_GEMINI_API_KEY=AIza... zeph

Or in config:

[llm]
[[llm.providers]]
type = "gemini"
model = "gemini-2.0-flash"    # or "gemini-2.5-pro" for extended thinking
max_tokens = 8192
# embedding_model = "text-embedding-004"  # enable Gemini-native embeddings
# thinking_level = "medium"              # Gemini 2.5+ only: minimal, low, medium, high

Gemini supports embeddings natively when embedding_model is set — no separate Ollama instance required. See LLM Providers — Gemini for the full feature matrix.

OpenAI

ZEPH_OPENAI_API_KEY=sk-... zeph
[llm]
[[llm.providers]]
type = "openai"
base_url = "https://api.openai.com/v1"
model = "gpt-5.2"
max_tokens = 4096
embedding_model = "text-embedding-3-small"
reasoning_effort = "medium"   # optional: low, medium, high (for o3, etc.)

When embedding_model is set, Qdrant subsystems use it automatically for skill matching and semantic memory.

o-Series Models (o1, o3, o4)

OpenAI’s o-series reasoning models have different configuration requirements from standard LLMs:

[[llm.providers]]
type = "openai"
model = "o3-mini"
max_completion_tokens = 16000      # Required: cap reasoning token budget (max 100,000)
# Note: o-series does not support:
# - max_tokens (use max_completion_tokens instead)
# - temperature (always 1.0)
# - top_p (always 1.0)
# - system prompts (limited support — use sparingly)

Cost control with reasoning models:

The max_completion_tokens parameter is critical for o-series models because reasoning tokens are 10–20× more expensive than regular completion tokens. Set a hard cap based on your task complexity:

  • Simple tasks (math, string manipulation): max_completion_tokens = 2000
  • Moderate tasks (code analysis, data retrieval): max_completion_tokens = 8000
  • Complex reasoning (multi-step analysis): max_completion_tokens = 16000+

Without a cap, reasoning models can generate 100,000+ tokens per request, leading to unexpected bills. Start conservatively and increase if the model runs out of tokens mid-reasoning.

Latency expectations:

Reasoning models typically take 5–30 seconds per request. If you pair o-series with faster models via cascading, configure the cascade to skip o-series for simple queries:

[llm]
routing = "cascade"

[[llm.providers]]
name = "fast"
type = "openai"
model = "gpt-4o-mini"

[[llm.providers]]
name = "reasoning"
type = "openai"
model = "o3-mini"
max_completion_tokens = 8000

Compatible APIs

Use type = "compatible" with the appropriate base_url:

[llm]
[[llm.providers]]
name = "groq"
type = "compatible"
base_url = "https://api.groq.com/openai/v1"
model = "llama-3.3-70b-versatile"
max_tokens = 4096

Common base_url values:

Providerbase_url
Together AIhttps://api.together.xyz/v1
Groqhttps://api.groq.com/openai/v1
Fireworkshttps://api.fireworks.ai/inference/v1
Local vLLMhttp://localhost:8000/v1

Hybrid Setup

Embeddings via free local Ollama, chat via paid Claude API:

[llm]
routing = "cascade"   # try cheapest provider first

[[llm.providers]]
name = "local"
type = "ollama"
model = "qwen3:8b"
embedding_model = "qwen3-embedding"
embed = true          # use this provider for embeddings

[[llm.providers]]
name = "cloud"
type = "claude"
model = "claude-sonnet-5"
max_tokens = 4096
default = true        # use this provider for chat by default

See Adaptive Inference for routing strategy options.

Interactive Setup

Run zeph init and select your provider in Step 2. The wizard handles model names, base URLs, and API keys. See Configuration Wizard.