Skip to content
llm logo

llm via Tokonomix

Add Tokonomix to llm’s extra-openai-models.yaml — reach 130+ models and consensus on one key from Simon Willison’s CLI.

extra-openai-models.yamlCLIApache-2.0 · open sourcemacOS · Windows · Linux
llm — command-line LLM client and library, via Tokonomix

What is llm?

llm is Simon Willison’s command-line client and Python library for large language models. It logs every prompt and response to SQLite, supports plugins, and can register any OpenAI-compatible model through a YAML file — which is exactly how Tokonomix plugs in.

  • Runs prompts from the shell and pipes stdin through a model.
  • Registers extra OpenAI-compatible models in extra-openai-models.yaml (model_id, model_name, api_base, api_key_name).
  • Supports tool calling via the supports_tools flag on a model entry.
  • Open source; keys are stored with llm keys set, not in the YAML.

Why route llm through Tokonomix?

  • One Tokonomix key in extra-openai-models.yaml reaches 130+ models without juggling per-provider keys.
  • Point a model_id at tokonomix-consensus so hard queries get a multi-model verdict; use a direct slug for routine one-liners.
  • Per-call spend caps bound usage, and region / origin routing keeps sensitive prompts compliant.
  • Every call is metered to the cent in your Tokonomix dashboard.

Connect Tokonomix in extra-openai-models.yaml

Add a Tokonomix model entry to extra-openai-models.yaml, then store the key with llm keys set.

# ~/.config/io.datasette.llm/extra-openai-models.yaml
- model_id: anthropic/claude-sonnet-4-6
  model_name: anthropic/claude-sonnet-4-6
  api_base: "https://tokonomix.ai/api/v1"
  api_key_name: tokonomix
  supports_tools: true
# Opt-in (planning/review only, no tool-calling): add a second entry with model_id/model_name: tokonomix-consensus

# then: llm keys set tokonomix   (paste tok-your-key)
# llm -m anthropic/claude-sonnet-4-6 "Explain quorum sensing"

Verify it works

  • Add the model entry and run llm keys set tokonomix to store your key.
  • Send a small prompt: llm -m tokonomix-consensus "Explain quorum sensing".
  • Confirm the call and token usage in your Tokonomix dashboard.

Model selection

Which model and endpoint should my agent use?

Pick by what your agent does, then swap the model id any time — every model in the catalog works through the same key.

What your agent doesUse this
Edits files / calls tools and streams responses (most coding agents)An Anthropic model via the Anthropic endpoint (tools + streaming both work)
Calls tools but does not need streaming (any model)The OpenAI-compatible endpoint with a single model id
Wants tools and streaming on a non-Anthropic modelRun non-streaming for now — streaming tool-calls on other providers is not enabled yet
Plain chat, no toolsEither endpoint; streaming is fine
Wants a cross-model verdict (consensus) on a high-stakes answerSet model to tokonomix-consensus on the OpenAI-compatible endpoint — note: consensus rejects tool requests (no tool-calling)
Endpoint & API reference (technical)

anthropic-messages → https://tokonomix.ai/api/anthropic — tools ✓, streaming ✓ (use an Anthropic model). openai-completions → https://tokonomix.ai/api/v1 — tools ✓ (single-model passthrough), streaming with tools not yet enabled. Plain chat: streaming works on both. Consensus: openai-completions, model tokonomix-consensus, no tools. Swap the model id to any slug returned by GET /api/v1/models.

Browse all models →

Related agents