Description
scorpiox-gemini is a high-performance, stateless HTTP proxy that translates Anthropic Claude API requests into Google Gemini API format on the fly. It allows any application or agent built for the Claude Messages API to transparently use Google Gemini models as the backend. The proxy handles request/response translation including streaming (SSE), tool use, system prompts, and multi-turn conversations — all without maintaining any server-side state. Written in pure C with yyjson for JSON parsing, it delivers minimal latency overhead.
Usage Examples
Basic — Start the proxy on default port
# Launch the Gemini proxy (listens on port 8080 by default)
$ scorpiox-gemini
scorpiox-gemini: listening on 0.0.0.0:8080
Set your Gemini API key
# Export your Google Gemini API key before starting
$ export GEMINI_API_KEY="AIzaSy..."
$ scorpiox-gemini
Use with Claude-compatible clients
# Point any Anthropic-compatible client at the proxy
$ export ANTHROPIC_BASE_URL="http://localhost:8080"
$ export ANTHROPIC_API_KEY="unused"
# Now use claude, scorpiox, or any Claude SDK — requests
# are transparently proxied to Google Gemini
Send a raw request via curl
$ curl http://localhost:8080/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: $GEMINI_API_KEY" \
-d '{
"model": "gemini-2.5-pro",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Explain quicksort in C"}
]
}'
Streaming with SSE
# Enable streaming — proxy converts Gemini stream to Anthropic SSE format
$ curl http://localhost:8080/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: $GEMINI_API_KEY" \
-d '{
"model": "gemini-2.5-flash",
"max_tokens": 2048,
"stream": true,
"messages": [
{"role": "user", "content": "Write a Makefile for a C project"}
]
}'
Use with scorpiox-code as a provider
# Configure scorpiox-code to route through the Gemini proxy
$ sx config set provider gemini
$ sx config set gemini_api_key "AIzaSy..."
# scorpiox-gemini runs automatically as the translation layer
$ sx "refactor this function to use error codes"
Source & Build Info
Source File
scorpiox/scorpiox-gemini.c
Lines of Code
1,808
Dependencies
libsxutil, yyjson