dev

Providers and models

Connect an LLM provider, choose a model, and understand where OpenCode keeps the resulting credentials and preferences.

Provider and model are different

A provider connection grants OpenCode access to one or more models. Model selection decides which available model a session uses. Setting AUGR_ADE_OPENCODE_PROVIDER_ID configures a provider; it does not choose a model.

Start without credentials

OpenCode may offer free hosted models in its model selector. Their names, availability, access conditions, limits, and privacy terms can change. Check OpenCode's current OpenCode model documentation before relying on one for a project.

Do not treat a free model as a private model

Privacy and data-use terms vary by provider. Do not send personal, confidential, or proprietary material until you have reviewed the terms for the selected model.

Connect a provider

Choose the method that matches the provider and your credential policy.

1. API key in the environment

Set the provider ID and token in env/dev/env.d/autograph.pkg.agent.env, then rebuild the aggregated configuration. This is suitable for providers that issue API keys.

env/dev/env.d/autograph.pkg.agent.env
AUGR_ADE_OPENCODE_PROVIDER_ID=anthropic
AUGR_ADE_OPENCODE_AUTH_TOKEN=your-api-key

The environment directory is gitignored, but the agent's rendered configuration consumes the key. Never commit, paste into documentation, or share the token.

2. API key through OpenCode

Start an OpenCode session, run /connect, select the provider, then enter its API key interactively. This keeps the provider choice out of the project env file.

3. OAuth or device login

For providers that offer an interactive sign-in flow, start the host-assisted login task:

dev-agent
task augr:pkg:agent:connect
metalab agent
task augr:pkg:metalab:connect

Open the URL printed by the task in the host browser and finish the provider flow. The task stores credentials in the selected agent's persistent OpenCode data volume. The dev-agent and metalab credentials are separate by default.

Choose or change a model

In an OpenCode session, run /models and choose from the available list. This changes the current session; it does not edit the project configuration.

To define the dev-agent project default, add a root model field to workspace/opencode.jsonc using an identifier displayed by /models:

workspace/opencode.jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "model": "provider-id/model-id"
}

A session-level choice takes precedence over this default. Metalab uses a different workspace, so configure its project default independently when needed.

Troubleshooting

  • If a model is absent from /models, confirm the provider connection and the account's entitlement before guessing a model ID.
  • If browser login is interrupted, run task augr:pkg:agent:connect:cleanup before retrying for the dev-agent.
  • If a provider is unreachable on a corporate network, review the Corporate proxy and Custom CA certificates pages.