Status: [UNTESTED]
Endpoints found:
http://localhost:8081/v1/chat/completions
Source: https://github.com/sunchengxing/gemini-web2api
# gemini-web2api
[中文文档](README_CN.md)
Convert Google Gemini's web interface into an OpenAI-compatible API. Zero authentication, zero cost, cross-platform.
## Features
- **Zero Auth**: No API key, no Google account needed (anonymous access)
- **OpenAI Compatible**: Drop-in replacement for `/v1/chat/completions` and `/v1/models`
- **Tool Calling**: Full function calling support (OpenAI format)
- **Multiple Models**: Flash, Flash Thinking (20k+ char output), Pro, Auto, Lite
- **Thinking Depth**: Adjustable via `@think=N` suffix (0=deepest, 4=shallowest)
- **Web Search**: Built-in internet access (Gemini's native search)
- **Cross-Platform**: Pure Python, no dependencies beyond stdlib
- **Streaming**: SSE streaming support
- **Codex CLI**: Responses API (`/v1/responses`) for OpenAI Codex integration
## Quick Start
```bash
python gemini_web2api.py
```
Server starts at `http://localhost:8081/v1`.
## Client Configuration
### Cherry Studio / ChatBox / any OpenAI client
| Field | Value |
|-------|-------|
| Base URL | `http://localhost:8081/v1` |
| API Key | `none` (or anything) |
| Model | `gemini-3.5-flash-thinking` |
### curl
```bash
curl http://localhost:8081/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"gemini-3.5-flash","messages":[{"role":"user","content":"Hello!"}]}'
```
### OpenAI Python SDK
```python
from openai import OpenAI
client = OpenAI(base_url="http://localhost:8081/v1", api_key="none")
resp = client.chat.completions.create(
model="gemini-3.5-flash-thinking",
messages=[{"role": "user", "content": "Explain quantum computing"}]
)
print(resp.choices[0].message.content)
```
## Available Models
| Model | Description | Output |
|-------|-------------|--------|
| `gemini-3.5-flash` | Fast general-purpose | ~12k chars |
| `gemini-3.5-flash-thinking` | Deep thinking, longest output | **~20k chars** |
| `gemini-3.5-flash