Skip to main content

leitum

Launch Claude Code against any LLM router.

PyPI version License

leitum demo: initialize, add an Ollama provider, then launch Claude Code with interactive provider and model selection

What is leitum?

leitum is a small CLI tool that launches Claude Code against alternative LLM routers and providers (Requesty, OpenRouter, LiteLLM, local Ollama, etc.) instead of the Anthropic API directly. It mirrors the ergonomics of ollama launch and omlx launch: prepend leitum to your claude invocation and get your chosen provider and models configured automatically.

Install

# via uvx (no install needed)
uvx leitum --version

# via pip
pip install leitum

# via Homebrew
brew tap rgielen/taps
brew install leitum

Quickstart

# Initialize config directory and example providers file
leitum init

# Set your API key
export REQUESTY_API_KEY=your-key-here

# Launch Claude Code via Requesty
leitum claude

# Dry-run: see what would happen without launching
leitum --dry-run claude

Configuration

Config lives at ~/.config/leitum/api-providers.yaml (XDG). Example:

schema_version: 1
providers:
  - name: requesty
    base_url: https://router.requesty.ai
    auth:
      token: ${REQUESTY_API_KEY}
    defaults:
      start: anthropic/claude-sonnet-4-5
    models:
      - id: anthropic/claude-sonnet-4-5
        roles: [sonnet, start]
      - id: anthropic/claude-opus-4-5
        roles: [opus]
      - id: anthropic/claude-haiku-4-5
        roles: [haiku]

See docs/configuration.md for the full schema reference.

Pin provider and models per repository with leitum.yaml (checked into version control):

schema_version: 1
provider: requesty
models:
  start: anthropic/claude-sonnet-4-5

Or let leitum write it for you: run leitum -l claude, make your selection, and the resolved provider and models are saved to leitum.yaml (comments and extra_env in an existing file are preserved, and the global state is left untouched).

Project-local secrets with .leitumenv

Place a .leitumenv file in your project root to supply API tokens automatically on every leitum claude invocation — without direnv or manual shell exports.

Security: .leitumenv is executed as a bash script, so only use it in repositories you trust. Never check it into version control.

# .leitumenv — never commit this file

# Plain assignment (no shell needed)
export REQUESTY_API_KEY=rq-...

# Command substitution — fetch the token from 1Password on every launch
export REQUESTY_API_KEY="$(op read op://vault/requesty/Token)"

# Any bash expansion works
MY_CUSTOM_VAR=some_value

leitum sources this file via bash before loading any config, so ${VAR} references in api-providers.yaml and leitum.yaml resolve against its values. All bash expansions are supported, including $(...).

Behaviour:

  • Shell environment takes precedence: a variable already set in your shell is never overwritten by .leitumenv.
  • Lines starting with # and blank lines are ignored.
  • A leading export prefix is accepted (but not required — set -a exports all assignments automatically).
  • Use --no-dotenv to skip loading the file for a single invocation.

Add .leitumenv to your project's .gitignore to prevent accidental commits of tokens. leitum's own .gitignore already includes it.

CLI Reference

leitum [OPTIONS] <subcommand> [ARGS...]

Global options (before the subcommand):

Flag Short Effect
--provider <name> -p Set provider
--use-last-provider -P Reuse last provider
--model <id> -m Set START model
--use-last-model -M Reuse last START model
--opus <id> -o Set OPUS model
--sonnet <id> -s Set SONNET model
--haiku <id> -k Set HAIKU model
--refresh -r Refresh model cache
--no-project-config Ignore leitum.yaml
--no-dotenv Skip loading .leitumenv from CWD
--save-local -l Save the resolved selection to leitum.yaml instead of global state
--dry-run Print env + exec line, do not launch
--verbose -v Verbose logging on stderr

During model selection, two keyboard shortcuts are available on every slot:

  • Ctrl-R — re-fetch the provider's model list from the API and rebuild the choices.
  • Ctrl-S — toggle saving the selection to leitum.yaml (equivalent to -l); the footer shows [save→project ON] when armed. Unavailable under --no-project-config.

Subcommands: claude, provider list/show/add/remove, refresh, doctor, init, completions.

See docs/commands.md for details.

Providers

Troubleshooting

Run leitum doctor for a full sanity check. See docs/troubleshooting.md.

Contributing

See CLAUDE.md and the PRDs in prd/ for the authoritative specification. Also see the Roadmap for planned and shipped features.

License

Apache 2.0 — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

leitum-0.1.6.tar.gz (2.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

leitum-0.1.6-py3-none-any.whl (39.3 kB view details)

Uploaded Python 3

File details

Details for the file leitum-0.1.6.tar.gz.

File metadata

  • Download URL: leitum-0.1.6.tar.gz
  • Upload date:
  • Size: 2.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for leitum-0.1.6.tar.gz
Algorithm Hash digest
SHA256 20f623a7d5afdb1fd89a50ad31a248f7f42df0f7f2351c22e7e738c6665ced46
MD5 2d8549ddbef37f3bf23a1ffec1121646
BLAKE2b-256 933821699229f2a84e5976d699becb4888efd26d669264d8f2dc5351c7f10032

See more details on using hashes here.

Provenance

The following attestation bundles were made for leitum-0.1.6.tar.gz:

Publisher: release.yml on rgielen/leitum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file leitum-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: leitum-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 39.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for leitum-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4405e67a3d6eda2cb4e421e7292f173a19aec1a1feff7876629c12fe3b992a8c
MD5 be7a175fa4a791fcaf6b66058adf8e7e
BLAKE2b-256 0dbae69d45a455acf4a6f09d4c3932557bebf7fa2f401d5bb5b01c0fd7e7826e

See more details on using hashes here.

Provenance

The following attestation bundles were made for leitum-0.1.6-py3-none-any.whl:

Publisher: release.yml on rgielen/leitum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page