Skip to main content

Local provider auth (btca-server)

btca reads credentials from OpenCode’s auth storage:
  • macOS/Linux: ~/.local/share/opencode/auth.json
  • Windows: %APPDATA%/opencode/auth.json
Supported providers:
  • opencode (API key)
  • openrouter (API key)
  • openai (OAuth, no API keys)
  • github-copilot (OAuth device flow)
  • openai-compat (optional API key)
  • anthropic (API key)
  • google (API key or OAuth)
  • minimax (API key)
Environment variable overrides:
  • OPENCODE_API_KEY (for provider opencode)
  • OPENROUTER_API_KEY (for provider openrouter)
  • MINIMAX_API_KEY (for provider minimax)

Connect or disconnect

btca connect
btca disconnect
btca wipe
btca connect performs OAuth for openai and github-copilot, prompts for API keys when required, and falls back to opencode auth --provider <provider> for other providers. btca wipe removes BTCA config files in the current directory and global BTCA config files (with a confirmation prompt unless --yes is passed). For github-copilot, btca uses device flow OAuth and opens a browser prompt to complete the sign-in. For openai-compat, btca connect also collects the required provider details:
  • Base URL (required): the root URL of your OpenAI-compatible server. The AI SDK appends its own endpoint paths, so btca must know the base URL to send requests to the correct host.
  • Provider name (required): the identifier the AI SDK uses to namespace requests for this OpenAI-compatible provider.
  • Model ID (required): the model to use for requests; stored in btca.config.jsonc as model.
  • API key (optional): only if your server requires authentication; stored in OpenCode auth.