Skip to content

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

bash
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

bash
export GROK_API_KEY="sk-your-key"
export GROK_BASE_URL="https://kuaiapi.net/v1"

OpenCode

Add a Provider in the OpenCode configuration:

json
{
  "provider": "kuai",
  "baseURL": "https://kuaiapi.net/v1",
 "apiKey": "sk-your-key"
}

General principles

ClientProtocol typeGroup platform to bind the key to
Gemini CLIGoogleGemini
Grok CLIxAIGrok
OpenCodeOpenAI-compatibleBased on the model source (OpenAI/Anthropic/Gemini)
CodexOpenAIOpenAI
Claude CodeAnthropicAnthropic

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

Ready to get started?

Sign up and get $0.30 in trial credit; usage is billed per token in real time, so you pay only for what you use.

Sign up freeSee model pricing

For lawful and compliant use only. Please follow our Terms of Service and your local laws and regulations.