InferRequest. The infer: verb takes a
model: <provider>/<name> string, looks up capability rules
( rules), and dispatches
through the right API dialect.
One InferRequest for all providers
nika-provider-anthropic, nika-provider-openai,
nika-provider-gemini, …) implements the single Provider trait from
nika-kernel:
API dialects (7)
Providers speak 7 distinct dialects. One provider crate per dialect + an OpenAI-compatible family that covers ~22 providers.| Dialect | Providers | Notes |
|---|---|---|
openai-chat | openai, mistral, groq, deepseek, xai, openrouter, together, fireworks, cerebras, sambanova, perplexity, moonshot, qwen, minimax, zhipu, nvidia-nim, deepinfra, replicate, hyperbolic, writer, databricks, azure, cloudflare | 23 providers share OpenAI’s /v1/chat/completions shape with per-provider base URL + auth header |
anthropic | anthropic | Native Messages API, tool use as schema, extended thinking |
gemini | gemini, vertex | Native generateContent API, safety settings, structured output via response_schema |
cohere | cohere | Native Command API |
ai21 | ai21 | Native Jamba API |
bedrock | bedrock | AWS SigV4, model-prefix routing (anthropic.claude-...) |
voyage | voyage | Embeddings-only |
Local runner: the
native provider uses mistral.rs to load GGUF
models on CPU / Metal / CUDA without any HTTP round-trip. Feature-gated
in nika-provider-native, off by default.Capability-aware routing
EveryInferRequest is routed through capability rules before
dispatch. The rules decide:
- What modalities the model accepts (text / image / audio / pdf / …).
- Whether tool calling + parallel tool calls are supported.
- Whether JSON mode is
unavailable/object/schema. - Whether streaming is native or emulated.
- Whether prompt caching / context caching reduces cost.
- Which supported parameters are legal (reasoning-effort, thinking- budget, computer-use, citations, …).
If you send
tools: [...] to a model whose capability rule says
tool_calling = false, Nika fails fast with NIKA-13x before hitting
the network — no silent provider-side error.Fallback chains (target design)
When a provider fails, Nika can route to a fallback:target design — a future minor
Why and not 9
Earlier drafts of this page listed 9 providers. That was a snapshot from
mid-2025 — today’s catalog is -deep, covering frontier
cloud labs, fast-inference shops (Groq, Cerebras, SambaNova), Chinese
labs (Moonshot, Qwen, MiniMax, Zhipu), enterprise platforms (Bedrock,
Azure, Vertex), and niche (Voyage embeddings, Writer enterprise).
Source of truth lives in the TOML and is build-time validated.
Adding a new provider
Add a `[[providers]]` block to `llm-providers.toml`
Declare
id, name, aliases, env_var, key_prefixes,
default_model, cheap_model, api_dialect, tags, and at least
one [[providers.models]] sub-block.Add capability rules if the provider has unique features
Put rules in
model-capabilities.toml scoped via scope.providers.
Inherit defaults if the provider is standard (most openai-chat
providers need no rules).Implement the L1 provider crate
If the
api_dialect already exists, wire a new provider instance
with the correct base URL + auth. If new dialect, new L1 crate
nika-provider-<name>.Pass the engine's admission checklist
Property test against the provider’s API contract. Criterion bench for
token throughput. Capability parity test. How admission works →.
See also
Providers catalog
All providers with env vars, default / cheap models, dialects.
Capability rules
Resolution algorithm and -rule contract.
Concepts · Verbs
The
infer: verb and its three siblings (exec / invoke / agent) — fetch is the nika:fetch builtin under invoke:.L0 decisions
Why capability rules use prefix matching, not regex (Q1).