- Home
- Skills
- Supercent Io
- Skills Template
- Opencode Authentication
opencode-authentication_skill
- Python
10
GitHub Stars
2
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill supercent-io/skills-template --skill opencode-authentication- SKILL.md11.1 KB
- SKILL.toon701 B
Overview
This skill documents Opencode OAuth and API-key authentication flows for Claude Code, Gemini/Antigravity, and OpenAI Codex. It explains which providers use OAuth vs API keys, where Opencode stores credentials, and the key operational constraints you must follow. Use it to configure multi-provider access, automate token management, and troubleshoot auth failures.
How this skill works
The guide describes provider-specific flows: Claude Code historically used OAuth 2.0 + PKCE (now blocked for third-party use, API keys required), Gemini/Antigravity uses Google OAuth via the opencode-antigravity plugin, and Codex integrates via the opencode-openai-codex plugin or API keys. It maps login commands (opencode auth login / provider-specific CLIs), token exchange endpoints, required request headers, credential storage locations, and multi-account load balancing for rate-limit mitigation. It also provides CLI examples to list, add, refresh, and remove credentials.
When to use it
- Initial Opencode setup and provider onboarding
- Integrating multiple AI providers into a single Opencode instance
- Troubleshooting OAuth token exchange or authorization failures
- Implementing multi-account load balancing to mitigate rate limits
- Switching from OAuth to API key mode due to provider policy changes
Best practices
- Prefer API keys for stability and long-term automation; store them in environment variables or secure stores
- Do not hardcode API keys or tokens in source code; use .env or vault solutions
- Automate token refresh and periodic checks (cron or CI jobs) to avoid unexpected expirations
- Separate configs per environment (dev/prod) using OPENCODE_CONFIG to avoid credential leaks
- Register multiple provider accounts only to mitigate rate limits responsibly; avoid abusive traffic
Example use cases
- Configure Opencode to use Gemini 3 Pro via opencode-google-antigravity-auth and switch models dynamically
- Add several Google accounts with opencode auth login to distribute requests across accounts for heavy workloads
- Migrate Claude Code usage to Anthropic API keys after third-party OAuth was blocked
- Use opencode auth list / remove to audit and rotate credentials regularly
- Script cron-based token refresh: 0 */6 * * * opencode auth refresh --silent
FAQ
No. As of January 2026, Anthropic blocked third-party usage of Claude Code subscription tokens; use Anthropic API keys instead.
Where does Opencode store OAuth credentials and account files?
Auth state is saved under XDG data paths, e.g. $XDG_DATA_HOME/opencode/ or ~/.local/share/opencode/; general auth config also appears in ~/.config/opencode/auth.json.
How many accounts can I register to mitigate rate limits?
Opencode supports adding multiple accounts (up to ten for Google Antigravity) and performs automatic load balancing; register responsibly and follow provider terms.