Kirsch docs menu

Kirsch documentation · v0.1.5

Set up a provider and model

Kirsch sends model requests through a provider endpoint. This page sets one up and checks it.

The built-in endpoints

Kirsch v0.1 speaks one wire format, the Anthropic Messages format, and has two built-in endpoints:

EndpointModelKey variableNotes
opencodeminimax-m3OPENCODE_API_KEYOpenCode Go. The default.
anthropicclaude-sonnet-5-5ANTHROPIC_API_KEY

You can also define an endpoint of your own. The fields it needs are in the [provider] reference.

TODO Where to get an OpenCode Go or Anthropic API key is not covered in Kirsch's own documentation yet.

Set up your API key

The default provider is opencode, and it reads its key from the environment variable OPENCODE_API_KEY. The built-in anthropic provider reads ANTHROPIC_API_KEY.

Export the key in your shell. Replace the placeholder with your own key:

export OPENCODE_API_KEY="<your-opencode-key>"

Add the line to your shell's startup file if you want it set in every session.

Kirsch also accepts the same name with a KIRSCH_ prefix, such as KIRSCH_OPENCODE_API_KEY. It checks the prefixed name first:

  1. KIRSCH_ followed by the api_key_env name, for example KIRSCH_OPENCODE_API_KEY.
  2. The api_key_env name itself, for example OPENCODE_API_KEY.

If both are set, the prefixed variable wins without a message. This lets Kirsch run alongside other tools that use the unprefixed name. An empty variable counts as unset. The /status command names the variable that supplied the key, never its value.

Never put an API key in a config file. API keys are never read from a config file. Kirsch refuses to start when any config file, global or project, contains a key whose name looks like a credential, such as api_key, token, secret or password. The full rule is under Secrets.

Use the default: opencode

Nothing to configure. With no config file at all, Kirsch uses the opencode endpoint and the minimax-m3 model. Export OPENCODE_API_KEY (or KIRSCH_OPENCODE_API_KEY) as above.

Switch to anthropic

Set the default endpoint in your global config file, ~/.config/kirsch/config.toml (or $XDG_CONFIG_HOME/kirsch/config.toml when XDG_CONFIG_HOME is set):

[provider]
default = "anthropic"

Then export the key it reads:

export ANTHROPIC_API_KEY="<your-anthropic-key>"

A project's .kirsch/config.toml cannot change the provider. A project file may set only context.project_files; see What the project file may set.

provider.default must name an endpoint defined under [provider], built-in or your own. Startup fails when no endpoint has that name.

Check it with kirsch doctor

cd /path/to/your/project
kirsch doctor

Two lines matter here. The key line shows which variable supplied the key, never the key itself:

ok  key: endpoint opencode: key found in OPENCODE_API_KEY

The model line shows the endpoint, the model and the context window Kirsch assumes for it:

ok  model: endpoint opencode, model minimax-m3: context window 128000 tokens

If the key line is a warning, the variable is not set in the shell you ran doctor from. The other lines it can print are on kirsch doctor checks.

Doctor makes no network calls, so it cannot tell you whether the provider accepts the key. If a prompt fails with HTTP 401 or 403, see 401 or 403: rejected the API key.

These pages describe Kirsch v0.1.5. Source: the doc folder for v0.1.5 on GitHub · releases.