Providers and setup

Connect one model, run a first question, and choose a default for your terminal and browser workflows.

On this page

term-llm runs on your machine; you choose where model inference happens. Start with one of the options below. You can add more providers and choose different models for individual agents later.

Try without an API key#

OpenCode Zen offers access to supported free hosted models:

bash
term-llm ask --provider zen "Explain git rebase in three sentences"

You should receive a short explanation. --provider zen explicitly selects the provider for this command; it does not change your saved default.

Zen is a third-party service. Free model availability, capacity, and limits can change, and paid models require a Zen API key. Your prompt is sent to Zen, not processed locally. If the default model is unavailable, inspect the current catalog:

bash
term-llm models --provider zen

Choose an available model with --provider zen:MODEL_ID, replacing MODEL_ID with the catalog entry. If no free model is available, use another connection option below.

Use a provider API key#

For example, with Anthropic:

bash
export ANTHROPIC_API_KEY=your-key
term-llm ask --provider anthropic "Explain git rebase in three sentences"

Replace your-key with your own key. Do not commit credentials to a repository. OpenAI, Gemini, OpenRouter, and other providers have their own environment variables; see the credential reference.

Provider API usage is billed by the provider. Installing term-llm does not include paid model access.

Use a supported subscription#

For an eligible ChatGPT account:

bash
term-llm ask --provider chatgpt "Explain git rebase in three sentences"

Follow the browser authentication flow on first use. Available models and limits depend on your account. Other supported integrations include GitHub Copilot, Grok subscription OAuth, and Claude Code; each has its own setup requirements.

Use a local model#

Start your Ollama or LM Studio server and load a model first. Then list the models it exposes:

bash
term-llm models --provider ollama
# Or: term-llm models --provider lmstudio

Use the returned model ID:

bash
term-llm ask --provider ollama:MODEL_ID "Explain git rebase in three sentences"

Replace MODEL_ID with an installed model. Model capability and your hardware determine which workflows work well; agent tasks need a model with suitable tool support.

Local inference does not automatically make every feature local. Search, MCP tools, media generation, and Guardian review may contact other services. Check those routes before sending sensitive material. See local endpoint configuration and the Guardian privacy note.

Save your preferred provider#

On an interactive first run, term-llm can guide you through provider setup. You can also set your default in $XDG_CONFIG_HOME/term-llm/config.yaml (normally ~/.config/term-llm/config.yaml). For example:

config.yaml · yaml
default_provider: zen

Merge that setting into an existing configuration rather than replacing the whole file. Substitute anthropic, chatgpt, or another configured provider if you chose a different option.

After saving a default, you can omit --provider:

bash
term-llm chat
term-llm serve web

chat starts the terminal interface. serve web starts the browser interface and prints its URL and authentication instructions. Start them separately; each remains running until you stop it.

Check your setup#

bash
term-llm providers --configured
term-llm models --provider zen

Replace zen with your chosen provider. If a request fails:

  • Authentication error: verify the provider name, key, or subscription login.
  • Model unavailable: list the current catalog and choose an available model.
  • Local connection refused: start your local model server and check its endpoint.
  • Rate limit or capacity error: wait, or switch to another configured provider.

For specific settings, see Provider setup details. For reasoning controls and model capabilities, see Providers and models.

Search documentation

Search commands, flags, workflows, and concepts.