unlimited.surf Transfer API Worker
Cloudflare Worker adapter for https://unlimited.surf that exposes OpenAI-compatible /v1/* routes and Anthropic-compatible /v1/messages plus /anthropic/* aliases.
Deploy from GitHub with Cloudflare
You can push this project to GitHub and let Cloudflare deploy it automatically on every commit.
1. Push the project to GitHub
Create a GitHub repository, then push this project directory to it. Do not commit your unlimited.surf API key.
2. Connect the GitHub repository in Cloudflare
- Open the Cloudflare Dashboard.
- Go to
Workers & Pages. - Choose
Create. - Choose
Import a repositoryorConnect to Git. - Authorize Cloudflare to access your GitHub account if prompted.
- Select the repository that contains this project.
- Set the project root directory to
/unless you put this project in a subdirectory.
3. Configure build and deploy settings
Use these settings in the Cloudflare deploy form:
Framework preset: None
Build command: npm install
Deploy command: npx wrangler deploy
Root directory: /
Wrangler config: wrangler.toml
If Cloudflare shows only one command field for Workers, use:
npm install && npx wrangler deploy
4. Add the API key as a Cloudflare secret
After the Worker project is created, add this secret in the Worker settings:
UNLIMITED_SURF_API_KEY=<your unlimited.surf key>
In the Cloudflare Dashboard this is usually under:
Workers & Pages -> your Worker -> Settings -> Variables -> Secrets
Keep the key as a secret. Do not put it in wrangler.toml, README.md, or GitHub repository files.
5. Deploy and verify
Trigger a deploy from Cloudflare or push a new commit to GitHub. After deployment, open:
https://<your-worker>.workers.dev/health
You should see a JSON response with "ok": true.
Then test the OpenAI-compatible route:
curl https://<your-worker>.workers.dev/v1/models
And test the Anthropic setup route:
curl https://<your-worker>.workers.dev/v1/setup
Manual deploy with Wrangler
You can also deploy directly from your local machine:
npm install -g wrangler
wrangler login
wrangler secret put UNLIMITED_SURF_API_KEY
wrangler deploy
Use your unlimited.surf key as the secret value. You can also omit the secret and pass a key per request with Authorization: Bearer <key> or x-api-key: <key>.
OpenAI-compatible routes
Base URL:
https://<your-worker>.workers.dev/v1
Supported routes:
GET /v1/modelsPOST /v1/chat/completionsPOST /v1/responsesPOST /v1/searchPOST /v1/mergeGET /v1/key,GET /v1/usagePOST /v1/filesPOST /v1/files/extract,POST /v1/attachments/extractGET /v1/setup,GET /v1/codex,GET /v1/mcp
Example:
curl https://<your-worker>.workers.dev/v1/chat/completions \
-H "Authorization: Bearer <key>" \
-H "Content-Type: application/json" \
-d '{"model":"gateway-gpt-5","messages":[{"role":"user","content":"Hello"}],"stream":true}'
Anthropic-compatible routes
Base URL:
https://<your-worker>.workers.dev
Supported routes:
POST /v1/messagesGET /v1/modelsPOST /anthropic/v1/messagesGET /anthropic/v1/modelsGET /v1/setup,GET /v1/codex,GET /v1/mcp
Claude Code PowerShell example:
$env:ANTHROPIC_BASE_URL = "https://<your-worker>.workers.dev"
$env:ANTHROPIC_AUTH_TOKEN = "<key>"
$env:ANTHROPIC_API_KEY = "<key>"
$env:ANTHROPIC_MODEL = "claude-opus-4-7-20260101"
claude
Feature mapping
- Chat maps to upstream
POST /api/chat. - Web Search maps to upstream
POST /api/searchwhen you call/v1/search, passweb_search_options, passquery, or include a web search tool. - Merge AI maps to upstream
POST /api/mergewhen you call/v1/merge, passmerge: true, or passmodelswith 2+ model IDs. - Models maps to upstream
GET /api/modelswith a fallback catalog if the upstream call fails. - Files maps upload/extract requests to upstream
POST /api/attachments/extract; persistent file storage is not implemented unless you add KV/R2. - Codex, Agent Setup, and MCP are exposed as setup/info endpoints. MCP servers still run in the client or IDE; this Worker only provides the model endpoint.
- Embeddings, audio, and images return
501because unlimited.surf does not expose those APIs in the provided docs.
Upstream raw proxy
Any /api/* request is forwarded to unlimited.surf with the configured key, so the original API remains available through the Worker.