All integrations

CLI Tools

Gemini CLI

Override the Gemini API address with a Gemini-compatible endpoint and model.

LimitedGeminiDocs checked

Configuration is available with version, account, region or feature restrictions. Read the conditions below first.

On this page

Before you begin

Install Gemini CLI and use a key group with access to Gemini-protocol models. A Chat Completions model is not interchangeable here.

Have an A2Agent API key ready and copy an accessible model ID from the catalog. Replace every placeholder, back up existing settings and keep keys out of repositories.

Setup

File contents are usually shared; switching OS changes commands and paths. For WSL on Windows, select macOS / Linux.

  1. 01Install the CLI

    Install the required Node.js version, then install and check the CLI.

    Open official documentation
    Shell
    npm install -g @google/gemini-cli
    gemini --version
  2. 02Use API key authentication

    Use the root URL without /v1 or /v1beta. Select Gemini API Key authentication; Google sign-in does not use this override.

    Shell
    export GEMINI_API_KEY='YOUR_A2AGENT_API_KEY'
    export GOOGLE_GEMINI_BASE_URL='https://a2agent.me'
    gemini --model YOUR_GEMINI_MODEL_ID

Capabilities and limits

  • The URL must use HTTPS, except for localhost development.
  • The CLI may use auxiliary models or server-side tools. One successful generation does not verify the entire agent workflow.

Verify the connection

Replace every placeholder and run locally. Expect JSON containing OK. Then start a new client conversation, test one read-only tool call separately, and confirm the requests in A2Agent usage records. This test incurs a small amount of model usage.

Shell
curl --fail-with-body --silent --show-error --max-time 60 'https://a2agent.me/v1beta/models/YOUR_GEMINI_MODEL_ID:generateContent' \
  -H 'Content-Type: application/json' \
  -H 'x-goog-api-key: YOUR_A2AGENT_API_KEY' \
  -d '{"contents":[{"parts":[{"text":"Reply with OK."}]}]}'

Troubleshooting

For a 404, check for a duplicated /v1beta. For authentication or model errors, check the key group and Gemini model ID.

401 / 403: authentication or access denied

Use a key issued by A2Agent, without extra spaces, and check that it is active and unexpired. Confirm the group permits the model and protocol. A vendor subscription credential cannot replace an A2Agent key.

404 / model not found: endpoint or model mismatch

Check the root URL, /v1 prefix and full request path against this guide; avoid duplicated paths. Model IDs are case-sensitive and must be accessible to the current key.

429: quota or rate limit

Check your balance, key limits, concurrent usage and service status. Wait before retrying and reduce simultaneous agents; repeated retries do not remove a quota limit.

Chat works, but tools fail or streaming stops

Test a short text request, then a single read-file tool call. Check tool support, output budget, proxy timeouts and client version. Inspect the diff before resuming a long task to avoid repeating actions.

Restore previous settings

Close the terminal, remove any saved GEMINI_API_KEY and GOOGLE_GEMINI_BASE_URL values, and restore the previous authentication method.

Sources and check date

Status is based on official configuration docs, not end-to-end client testing with A2Agent.

Docs checked 2026-09-18