Models
anki-llm sends OpenAI-compatible Chat Completions requests. Any model name is accepted, and a custom base URL supports hosted compatible APIs and local servers.
Built-in provider detection
Section titled “Built-in provider detection”The model prefix selects a built-in endpoint and provider-specific key:
| Model prefix | Endpoint | API key |
|---|---|---|
gemini- | https://generativelanguage.googleapis.com/v1beta/openai | GEMINI_API_KEY |
deepseek- | https://api.deepseek.com | DEEPSEEK_API_KEY |
grok- | https://api.x.ai/v1 | XAI_API_KEY |
| Any other prefix | OpenAI default | OPENAI_API_KEY |
export OPENAI_API_KEY="..."export GEMINI_API_KEY="..."export DEEPSEEK_API_KEY="..."export XAI_API_KEY="..."Create keys through OpenAI, Google AI Studio, DeepSeek, or xAI.
With no explicit model, resolution is:
--modeldefault_modelin the effective workspace’sanki-llm.yaml- Global
model - A key-based default:
gemini-2.5-flash,deepseek-v4-flash,grok-4.3, orgpt-5, checked in that order
A model that does not match Gemini, DeepSeek, or Grok uses OpenAI defaults unless you configure a custom endpoint.
OpenRouter
Section titled “OpenRouter”OpenRouter exposes many provider-qualified models through one compatible endpoint and API key:
export ANKI_LLM_API_KEY="your-openrouter-key"anki-llm generate "今日" \ --api-base-url https://openrouter.ai/api/v1 \ --model anthropic/claude-sonnet-4Persist the endpoint and model:
anki-llm config set api_base_url https://openrouter.ai/api/v1anki-llm config set model anthropic/claude-sonnet-4Model names are forwarded unchanged. Use OpenRouter’s provider-qualified model ID.
Local servers
Section titled “Local servers”Ollama, llama.cpp, vLLM, and similar servers work when they expose /v1/chat/completions:
anki-llm generate "今日" \ --api-base-url http://localhost:11434/v1 \ --model llama3A custom endpoint does not require a key from anki-llm. The server can still require authentication, in which case pass --api-key or set ANKI_LLM_API_KEY.
For safety, provider-specific keys are not sent to a custom endpoint. If OPENAI_API_KEY is set and --api-base-url points elsewhere, anki-llm does not forward that key unless it is supplied through the generic key setting.
Other compatible APIs
Section titled “Other compatible APIs”anki-llm process-file input.yaml \ --output output.yaml \ --prompt prompt.md \ --api-base-url https://api.together.xyz/v1 \ --api-key your-key \ --model meta-llama/Llama-3-70b-chat-hfTogether, Fireworks, Groq, proxies, and private gateways follow the same pattern. Compatibility depends on the endpoint accepting the request fields used by the selected command.
Endpoint and key precedence
Section titled “Endpoint and key precedence”API base URL:
--api-base-urlANKI_LLM_API_BASE_URL- Global
api_base_url - Built-in provider detection
API key:
--api-keyANKI_LLM_API_KEY- Provider-specific environment variable, only for an auto-detected endpoint
API keys are not stored in the global LLM configuration. Use environment variables or a command flag.
Reasoning effort
Section titled “Reasoning effort”Reasoning effort is an optional provider-neutral top-level field in the standard Chat Completions request.
anki-llm config set reasoning_effort lowexport ANKI_LLM_REASONING_EFFORT=mediumdefault_model: gpt-5.4-minireasoning_effort: highanki-llm process-file input.csv \ --output output.csv \ --prompt prompt.md \ --reasoning-effort xhighResolution order is CLI, ANKI_LLM_REASONING_EFFORT, workspace, global config, then unset. Values are trimmed and must be non-empty. anki-llm does not enforce a fixed vocabulary because providers and models differ. Common values include none, minimal, low, medium, high, xhigh, and max.
When unset, the request omits reasoning_effort and the provider chooses its default. A compatible server must accept the field if you set it.
Known models and cost estimates
Section titled “Known models and cost estimates”The built-in pricing table recognizes exact model IDs in these families:
- OpenAI: GPT-4.1, GPT-4o, GPT-5 through GPT-5.4, including listed mini and nano variants
- Google: Gemini 2.0 Flash, Gemini 2.5 Flash, Flash Lite and Pro, plus listed Gemini 3 preview models
- DeepSeek:
deepseek-v4-flashanddeepseek-v4-pro - xAI:
grok-4.3
Known models appear in the TUI picker when their provider key is available. A generic ANKI_LLM_API_KEY makes all known models available in the picker, and the configured model is included even when unknown.
Pricing is an exact-name lookup, not provider discovery and not a whitelist. Unknown or provider-qualified names still run, but their cost estimate is unavailable. Estimates multiply reported input and output token counts by these built-in per-million-token rates:
| Model | Input / 1M | Output / 1M | Provider reference |
|---|---|---|---|
gpt-4.1 | $2.00 | $8.00 | OpenAI |
gpt-4.1-mini | $0.40 | $1.60 | OpenAI |
gpt-4.1-nano | $0.10 | $0.40 | OpenAI |
gpt-4o | $2.50 | $10.00 | OpenAI |
gpt-4o-mini | $0.15 | $0.60 | OpenAI |
gpt-5 | $1.25 | $10.00 | OpenAI |
gpt-5-mini | $0.25 | $2.00 | OpenAI |
gpt-5-nano | $0.05 | $0.40 | OpenAI |
gpt-5.1 | $1.25 | $10.00 | OpenAI |
gpt-5.2 | $1.75 | $14.00 | OpenAI |
gpt-5.3 | $1.75 | $14.00 | OpenAI |
gpt-5.4 | $2.50 | $15.00 | OpenAI |
gpt-5.4-mini | $0.75 | $4.50 | OpenAI |
gpt-5.4-nano | $0.20 | $1.25 | OpenAI |
gemini-2.0-flash | $0.10 | $0.40 | |
gemini-2.5-flash | $0.30 | $2.50 | |
gemini-2.5-flash-lite | $0.10 | $0.40 | |
gemini-2.5-pro | $1.25 | $10.00 | |
gemini-3-flash-preview | $0.50 | $3.00 | |
gemini-3.1-flash-lite-preview | $0.25 | $1.50 | |
gemini-3.1-pro-preview | $2.00 | $12.00 | |
deepseek-v4-flash | $0.14 | $0.28 | DeepSeek |
deepseek-v4-pro | $1.74 | $3.48 | DeepSeek |
grok-4.3 | $1.25 | $2.50 | xAI |
DeepSeek estimates use cache-miss, undiscounted rates.
Treat every displayed cost as guidance:
- Provider prices can change after anki-llm ships.
- Cached input, batch discounts, taxes, free tiers, routing markups, and custom contracts are not modeled.
- OpenRouter and other gateways can price the same model differently.
- Providers can report usage differently, especially reasoning tokens.
- Extra processing steps make additional requests.
Check the provider’s current pricing before a large run. Use --limit on a representative sample and extrapolate from the token and cost summary.