Configure Gemini CLI / Grok CLI / OpenCode
These clients also need only two things: "API address + key". Below is the general configuration method; for specifics, go by the recommended configuration in "Use Key".
Gemini CLI
export GEMINI_API_KEY="sk-your-key"
export GEMINI_BASE_URL="https://kuaiapi.net/v1"Or edit the Gemini CLI configuration file and point the API endpoint to this site's Gemini-compatible endpoint.
TIP
This site may provide a "built-in Gemini CLI OAuth Client" that supports direct sign-in with Code Assist / Google One accounts. See the site announcements for details.
Grok CLI
export GROK_API_KEY="sk-your-key"
export GROK_BASE_URL="https://kuaiapi.net/v1"OpenCode
Add a Provider in the OpenCode configuration:
{
"provider": "kuai",
"baseURL": "https://kuaiapi.net/v1",
"apiKey": "sk-your-key"
}General principles
| Client | Protocol type | Group platform to bind the key to |
|---|---|---|
| Gemini CLI | Gemini | |
| Grok CLI | xAI | Grok |
| OpenCode | OpenAI-compatible | Based on the model source (OpenAI/Anthropic/Gemini) |
| Codex | OpenAI | OpenAI |
| Claude Code | Anthropic | Anthropic |
WARNING
Protocol mismatch is the most common error: the group platform to which a key is bound must match the client protocol. For example, using a key from an Anthropic group to call an OpenAI client will always fail.
Can't find a tag/variable?
- Only use the client tags and variables actually provided by the current group
- Prefer "Use Key" to generate them in one click instead of guessing parameters manually
