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
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)
OPENCODE_API_KEY(for provideropencode)OPENROUTER_API_KEY(for provideropenrouter)
Connect or disconnect
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.
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.jsoncasmodel. - API key (optional): only if your server requires authentication; stored in OpenCode auth.