Skip to content
This repository was archived by the owner on Feb 19, 2026. It is now read-only.

Custom Proxy Support #22

@dongguowu

Description

@dongguowu

Using a Custom Proxy

This server supports routing requests through any OpenAI-compatible API proxy instead of connecting directly to Google's Gemini API.

To use a custom proxy, set the following environment variables in your .env file:

CUSTOM_PROXY_URL: The base URL of your proxy endpoint (e.g., https://my-proxy.com/v1).
CUSTOM_PROXY_API_KEY: The API key for your proxy service.

When CUSTOM_PROXY_URL is set, the GEMINI_API_KEY is no longer required. The server will automatically:

  • Route all completion requests to your proxy's URL.
  • Use the CUSTOM_PROXY_API_KEY for authentication.
  • Adjust model names by removing the gemini/ prefix to ensure compatibility with standard OpenAI-like proxies.
  • Switch to an OpenAI-compatible tokenizer (tiktoken) for the /v1/messages/count_tokens endpoint.
  • The server will now send requests to https://api.example.com/v1 instead of Google's servers.

see https://github.com/dongguowu/gemini-for-claude-code/tree/custom-proxy-support

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions