[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-82321":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":30,"readmeContent":31,"aiSummary":32,"trendingCount":15,"starSnapshotCount":15,"syncStatus":33,"lastSyncTime":34,"discoverSource":35},82321,"opencode-cowork-proxy","cucoleadan\u002Fopencode-cowork-proxy","cucoleadan","Minimal Cloudflare Worker that routes Claude Desktop\u002FCowork to OpenCode Zen and Go models","",null,"TypeScript",29,13,21,0,3,8,9,54.24,"MIT License",false,"main",true,[25,26,27,28,29],"claude-code","claude-cowork","cloudflare-workers","open-source","opencode","2026-06-12 04:01:37","# OpenCode Cowork Proxy Worker\n\n[![Deploy to Cloudflare Workers](https:\u002F\u002Fdeploy.workers.cloudflare.com\u002Fbutton)](https:\u002F\u002Fdeploy.workers.cloudflare.com\u002F?url=https:\u002F\u002Fgithub.com\u002Fcucoleadan\u002Fopencode-cowork-proxy)\n\nThis project lets Claude use OpenCode Go models, and some OpenCode Zen models.\n\nClaude normally speaks the Anthropic API format. OpenCode Go mostly speaks OpenAI-compatible API format. This small Cloudflare Worker sits in the middle and translates between them.\n\nI covered how to set this up in Claude in [How to Use Claude Code for Free with OpenCode](https:\u002F\u002Fvibestacklab.substack.com\u002Fp\u002Fhow-to-use-claude-code-for-free-with).\n\n### Image \u002F Vision Support\n\nWhen you attach an image in Claude Code and send it through this proxy, the request is automatically routed to **Qwen3.6 Plus** (`qwen3.6-plus`) — a vision-capable model available on both OpenCode Go and OpenCode Zen. This happens transparently: the proxy detects image blocks in your request, translates them to OpenAI's image format, and overrides the model to Qwen3.6 Plus so the model can actually see the image.\n\nNo configuration needed — it just works as long as you have an OpenCode Go or Zen subscription.\n\n## Free Models\n\nWe support a pay-as-you-go model. Below are the prices per 1M tokens for completely free models available through OpenCode Zen.\n\n| Model | Model ID | Input | Output | Cached Read |\n|-------|----------|-------|--------|-------------|\n| Big Pickle | `big-pickle` | Free | Free | Free |\n| DeepSeek V4 Flash Free | `deepseek-v4-flash-free` | Free | Free | Free |\n| MiMo-V2.5 Free | `mimo-v2.5-free` | Free | Free | Free |\n| Nemotron 3 Super Free | `nemotron-3-super-free` | Free | Free | Free |\n\nThese models are available at `https:\u002F\u002Fopencode.ai\u002Fzen\u002Fv1\u002Fchat\u002Fcompletions` via the `\u002Fzen` prefix. For the full model list and latest pricing, see the [OpenCode Zen endpoint docs](https:\u002F\u002Fopencode.ai\u002Fdocs\u002Fzen\u002F#endpoints).\n\n## Set Up In Claude\n\nIf you want the fastest working setup, use `mimo-v2.5-free` as the first model.\n\n1. Deploy this Worker to Cloudflare.\n2. Copy your deployed Worker URL.\n3. In Claude, open **Configure third-party Inference**.\n4. Choose the gateway \u002F third-party inference option.\n5. Set the base URL to `YOUR_DEPLOYED_WORKER_URL\u002Fzen`.\n6. Set the auth scheme to `x-api-key`.\n7. Paste your OpenCode API key.\n8. Add `mimo-v2.5-free` as the model name.\n\nImportant: do not add `\u002Fv1\u002Fmessages` to the URL. Claude adds that path automatically.\n\n## Quick Claude Configuration\n\nUse these values in Claude's **Configure third-party Inference** screen:\n\n| Setting | Value |\n|---------|-------|\n| Provider | Gateway \u002F third-party inference gateway |\n| Base URL | `YOUR_DEPLOYED_WORKER_URL\u002Fzen` |\n| Auth scheme | `x-api-key` |\n| API key | Your OpenCode API key |\n| Models | Add manually, for example `mimo-v2.5-free` |\n\nFor the default example above, use `\u002Fzen` because `mimo-v2.5-free` is a Zen model. Use `\u002Fgo` for OpenCode Go models instead. Do not add `\u002Fv1\u002Fmessages` yourself. Claude adds the API path automatically.\n\n## What This Does\n\nThe Worker accepts Claude's Anthropic-style requests at `\u002Fv1\u002Fmessages`, converts them to OpenAI-style requests, and sends them to OpenCode Go by default.\n\nYou can choose an OpenCode upstream by adding a prefix to the Worker URL:\n\n| Worker URL suffix | Upstream |\n|-------------------|----------|\n| no suffix | OpenCode Go |\n| `\u002Fgo` | OpenCode Go |\n| `\u002Fzen` | OpenCode Zen |\n\nFor example, use `YOUR_DEPLOYED_WORKER_URL\u002Fgo` for Go models and `YOUR_DEPLOYED_WORKER_URL\u002Fzen` for Zen models.\n\nIt also handles tool calls, streaming, and DeepSeek reasoning output so coding-agent workflows work correctly.\n\nImportant: this proxy has been live-tested with `minimax-m3` and `minimax-m2.7`. Other OpenCode Go models are included from the public OpenCode Go model list, but provider behavior can vary, especially around streaming usage\u002Ftoken accounting.\n\n## Important Zen Limitation\n\nOpenCode Zen support is partial.\n\nThis proxy currently works with Zen models that use the OpenAI-compatible `\u002Fchat\u002Fcompletions` endpoint.\n\nKnown Zen model categories that should work through `\u002Fzen`:\n\n| Zen model category | Examples |\n|--------------------|----------|\n| OpenAI-compatible chat models | `minimax-m2.7`, `minimax-m2.5`, `mimo-v2.5-free`, `glm-5.1`, `glm-5`, `kimi-k2.5`, `kimi-k2.6`, `grok-build-0.1`, `big-pickle`, `deepseek-v4-flash`, `deepseek-v4-flash-free`, `nemotron-3-super-free` |\n\nKnown Zen model categories that do not work yet through this proxy:\n\n| Zen model category | Why it does not work yet |\n|--------------------|--------------------------|\n| GPT models such as `gpt-5.5`, `gpt-5.5-pro`, `gpt-5.4`, `gpt-5.4-pro`, `gpt-5.3-codex`, `gpt-5.2` | Zen exposes these through `\u002Fresponses`, and this proxy does not yet translate Anthropic Messages to OpenAI Responses API. |\n| Claude models such as `claude-opus-4-8`, `claude-sonnet-4-6`, `claude-haiku-4-5` | Zen exposes these through `\u002Fmessages`; this proxy's `\u002Fzen` Claude path currently translates to OpenAI-compatible `\u002Fchat\u002Fcompletions`. |\n| Qwen models such as `qwen3.7-max`, `qwen3.6-plus`, `qwen3.5-plus` | Zen exposes these through `\u002Fmessages` (Anthropic-compatible), not `\u002Fchat\u002Fcompletions`. |\n| Gemini models such as `gemini-3.5-flash`, `gemini-3.1-pro`, `gemini-3-flash` | Zen exposes these through model-specific endpoints, not the generic chat-completions path used here. |\n\nUse `\u002Fgo` for OpenCode Go. Use `\u002Fzen` only for Zen models listed as OpenAI-compatible chat models in the [OpenCode Zen endpoint docs](https:\u002F\u002Fopencode.ai\u002Fdocs\u002Fzen\u002F#endpoints).\n\n## For Developers (OpenCode Cowork Proxy Worker)\n\nTechnically, this is a Cloudflare Worker gateway that lets Anthropic\u002FClaude clients talk to OpenAI-compatible APIs, and lets OpenAI clients talk to Anthropic-compatible APIs.\n\nThe default upstream is [OpenCode Go](https:\u002F\u002Fopencode.ai\u002Fdocs\u002Fgo\u002F#endpoints):\n\n```text\nhttps:\u002F\u002Fopencode.ai\u002Fzen\u002Fgo\u002Fv1\n```\n\nThis means Claude can be configured to use OpenCode Go models through this proxy without additional server-side configuration.\n\n```text\nClaude \u002F Anthropic SDK  ->  \u002Fv1\u002Fmessages           ->  OpenAI-compatible upstream\nOpenAI SDK              ->  \u002Fv1\u002Fchat\u002Fcompletions   ->  OpenAI-compatible upstream\nOpenAI SDK              ->  \u002Fv1\u002Fchat\u002Fcompletions   ->  Anthropic upstream with x-upstream-format: anthropic\n```\n\n## Detailed Claude Setup\n\nUse Claude's **Configure third-party Inference** flow and add the Worker as a custom gateway.\n\nConfigure the gateway like this:\n\n| Setting | Value |\n|---------|-------|\n| Base URL | Your deployed Worker URL, or add `\u002Fgo` or `\u002Fzen` |\n| Auth scheme | `x-api-key` |\n| API key | Your OpenCode Go API key |\n| Model | Add manually, for example `deepseek-v4-pro` |\n\nDo not include `\u002Fv1\u002Fmessages` in the Claude base URL. Claude will call `\u002Fv1\u002Fmessages`; the Worker handles that path.\n\nUse `\u002Fgo` for OpenCode Go subscription models. Use `\u002Fzen` only for OpenCode Zen models available through the OpenAI-compatible `\u002Fchat\u002Fcompletions` endpoint. Zen GPT `\u002Fresponses`, Zen Claude `\u002Fmessages`, and Zen Gemini model-specific endpoints are not supported yet.\n\n### Manual Model Setup\n\nClaude may not discover the OpenCode Go models automatically. Add the model manually in **Configure third-party Inference**.\n\nCommon OpenCode Go model IDs:\n\n| Model | Model ID | Upstream API style |\n|-------|----------|--------------------|\n| GLM-5.1 | `glm-5.1` | OpenAI-compatible |\n| GLM-5 | `glm-5` | OpenAI-compatible |\n| Kimi K2.5 | `kimi-k2.5` | OpenAI-compatible |\n| Kimi K2.6 | `kimi-k2.6` | OpenAI-compatible |\n| DeepSeek V4 Pro | `deepseek-v4-pro` | OpenAI-compatible |\n| DeepSeek V4 Flash | `deepseek-v4-flash` | OpenAI-compatible |\n| MiMo-V2.5-Pro | `mimo-v2.5-pro` | OpenAI-compatible |\n| MiMo-V2.5 | `mimo-v2.5` | OpenAI-compatible |\n| MiniMax M3 | `minimax-m3` | Anthropic-compatible upstream |\n| MiniMax M2.7 | `minimax-m2.7` | Anthropic-compatible upstream |\n| MiniMax M2.5 | `minimax-m2.5` | Anthropic-compatible upstream |\n| Qwen3.7 Max | `qwen3.7-max` | Anthropic-compatible upstream |\n| Qwen3.6 Plus | `qwen3.6-plus` | Anthropic-compatible upstream |\n\nFor the latest list, see the OpenCode Go endpoint docs:\n\n```text\nhttps:\u002F\u002Fopencode.ai\u002Fdocs\u002Fgo\u002F#endpoints\n```\n\nFor OpenCode's own config files, model IDs use the `opencode-go\u002F\u003Cmodel-id>` format. For Claude's third-party inference setup through this proxy, use the raw API model ID such as `deepseek-v4-pro`, `kimi-k2.6`, or `minimax-m3`.\n\n### `claude.json` Example\n\nYou can also configure Claude with a `claude.json` gateway entry. Replace the Worker URL and API key with your own values.\n\n```json\n{\n  \"inferenceProvider\": \"gateway\",\n  \"inferenceGatewayBaseUrl\": \"YOUR_DEPLOYED_WORKER_URL\u002Fgo\",\n  \"inferenceGatewayApiKey\": \"YOUR_OPENCODE_GO_API_KEY\",\n  \"inferenceGatewayAuthScheme\": \"x-api-key\",\n  \"inferenceModels\": [\n    {\n      \"name\": \"glm-5.1\"\n    },\n    {\n      \"name\": \"glm-5\"\n    },\n    {\n      \"name\": \"kimi-k2.5\"\n    },\n    {\n      \"name\": \"kimi-k2.6\"\n    },\n    {\n      \"name\": \"deepseek-v4-pro\"\n    },\n    {\n      \"name\": \"deepseek-v4-flash\"\n    },\n    {\n      \"name\": \"mimo-v2.5-pro\"\n    },\n    {\n      \"name\": \"mimo-v2.5\"\n    },\n    {\n      \"name\": \"minimax-m3\"\n    },\n    {\n      \"name\": \"minimax-m2.7\"\n    },\n    {\n      \"name\": \"minimax-m2.5\"\n    },\n    {\n      \"name\": \"qwen3.7-max\"\n    },\n    {\n      \"name\": \"qwen3.6-plus\"\n    }\n  ]\n}\n```\n\n## Deploy On Cloudflare\n\nThis project is intended to run as a Cloudflare Worker. Deploy it to Cloudflare using either the deploy button above or Cloudflare's Git-based Worker deployment flow.\n\nUse these settings when connecting the repository in Cloudflare:\n\n| Setting | Value |\n|---------|-------|\n| Build command | empty |\n| Deploy command | `npm run deploy` |\n| Production branch | `main` |\n\nDo not deploy this as a normal Node.js web app. `wrangler deploy` builds and publishes the Worker from `wrangler.toml`.\n\n## Configuration\n\nThe Worker is zero-config by default. It forwards to OpenCode Go using OpenAI-compatible format. You can also route to OpenCode Zen by adding `\u002Fzen` to the Worker URL.\n\nOptional request headers:\n\n| Header | Default | Description |\n|--------|---------|-------------|\n| `x-upstream-url` | `https:\u002F\u002Fopencode.ai\u002Fzen\u002Fgo\u002Fv1` | Upstream API base URL |\n| `x-upstream-format` | `openai` | Upstream format: `openai` or `anthropic` |\n| `x-api-key` | required | Upstream API key |\n| `authorization` | optional | `Bearer \u003Ckey>` also works |\n| `anthropic-version` | `2023-06-01` | Forwarded when calling Anthropic-compatible upstreams |\n| `anthropic-beta` | unset | Forwarded when calling Anthropic-compatible upstreams |\n\nThe API key is validated locally before any upstream call. Missing or short keys receive a 401 response.\n\nPrefix routes:\n\n| Path prefix | Upstream base URL |\n|-------------|-------------------|\n| `\u002Fgo` | `https:\u002F\u002Fopencode.ai\u002Fzen\u002Fgo\u002Fv1` |\n| `\u002Fzen` | `https:\u002F\u002Fopencode.ai\u002Fzen\u002Fv1` |\n\n### Model Name Override\n\nClaude Desktop may reject model names that don't look like Anthropic models (e.g. `claude-sonnet-4-5` or `anthropic\u002Fclaude-*`). To work around this, embed the real model name in the URL path after the prefix:\n\n```\nYOUR_DEPLOYED_WORKER_URL\u002Fzen\u002Fmimo-v2.5-free   # free Zen models\nYOUR_DEPLOYED_WORKER_URL\u002Fgo\u002Fdeepseek-v4-pro   # paid Go models\n```\n\nClaude appends `\u002Fv1\u002Fmessages`, so the full request becomes `YOUR_WORKER_URL\u002Fzen\u002Fmimo-v2.5-free\u002Fv1\u002Fmessages`. The proxy extracts the model from the path and uses it regardless of what Claude sends in the request body.\n\n**Usage:**\n1. Configure Claude with any Anthropic-looking model name (e.g. `claude-sonnet-4-5-20250514`) — this passes Claude's client-side validation.\n2. Set the base URL to `YOUR_WORKER_URL\u002Fzen\u002FREAL_MODEL_ID` (replace `REAL_MODEL_ID` with the actual OpenCode model).\n3. The proxy silently maps the model for the upstream request.\n4. The response uses the original model name you configured, so Claude sees consistency.\n\n| Setting | Value |\n|---------|-------|\n| Base URL | `YOUR_WORKER_URL\u002Fzen\u002Fmimo-v2.5-free` |\n| Auth scheme | `x-api-key` |\n| API key | Your OpenCode API key |\n| Model | `claude-sonnet-4-5-20250514` (any Anthropic-looking name) |\n\nThis works with all Go and Zen models.\n\n## API Endpoints\n\n| Path | Method | Purpose |\n|------|--------|---------|\n| `\u002Fv1\u002Fmessages` | POST | Anthropic Messages API. Translates to OpenAI format by default. |\n| `\u002Fv1\u002Fchat\u002Fcompletions` | POST | OpenAI Chat Completions API. Pass-through by default. |\n| `\u002Fv1\u002Fmodels` | GET | Model discovery proxy. |\n\n## OpenAI SDK Usage\n\nPoint any OpenAI-compatible client at the gateway. By default, `\u002Fv1\u002Fchat\u002Fcompletions` passes through to OpenCode Go.\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"YOUR_DEPLOYED_WORKER_URL\u002Fv1\",\n    api_key=\"your-opencode-go-api-key\",\n)\n\nresponse = client.chat.completions.create(\n    model=\"deepseek-v4-pro\",\n    messages=[{\"role\": \"user\", \"content\": \"Hello\"}],\n)\n```\n\n## OpenAI SDK To Anthropic\n\nSet `x-upstream-format: anthropic` and point `x-upstream-url` at an Anthropic-compatible API.\n\n```bash\ncurl YOUR_DEPLOYED_WORKER_URL\u002Fv1\u002Fchat\u002Fcompletions \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -H \"x-api-key: YOUR_ANTHROPIC_KEY\" \\\n  -H \"x-upstream-url: https:\u002F\u002Fapi.anthropic.com\" \\\n  -H \"x-upstream-format: anthropic\" \\\n  -d '{\"model\":\"claude-sonnet-4-20250514\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}]}'\n```\n\n## Translation Notes\n\nThe gateway handles:\n\n- Anthropic Messages requests to OpenAI Chat Completions requests\n- OpenAI Chat Completions responses to Anthropic Messages responses\n- Tool calls and tool results in both directions\n- Streaming SSE in both directions\n- DeepSeek\u002FOpenAI `reasoning_content` as Anthropic `thinking` blocks\n- Prompt cache key injection for OpenAI-style prefix caching\n\n## Prompt Caching\n\nWhen translating Anthropic to OpenAI, the gateway injects a `prompt_cache_key` derived from a hash of the system prompt. This keeps requests with the same system prompt routed to the same backend node when the upstream supports OpenAI-style prefix caching.\n\nCache hit tokens from OpenAI-compatible usage metadata are mapped back to Anthropic's `cache_read_input_tokens` field.\n\n## Development\n\n```bash\nnpm install\nnpm test\nnpm run deploy -- --dry-run\n```\n\nProject structure:\n\n```text\nsrc\u002F\n├── index.ts                          Main Worker router and auth gate\n├── auth.ts                           API key extraction and validation\n├── cache.ts                          Prompt cache key utilities\n└── translate\u002F\n    ├── request\u002F                      Request translators\n    ├── response\u002F                     Response translators\n    └── stream\u002F                       SSE stream translators\ntest\u002F\n├── auth.test.ts\n├── cache.test.ts\n├── index.test.ts\n├── request.test.ts\n├── response.test.ts\n└── stream.test.ts\n```\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n","该项目是一个轻量级的Cloudflare Worker，用于将Claude Desktop\u002FCowork请求路由到OpenCode Go模型。它能够自动转换Claude使用的Anthropic API格式与OpenCode Go支持的OpenAI兼容API格式之间的通信。此外，该代理还支持图像\u002F视觉处理，当用户在Claude Code中附加图片时，请求会被透明地重定向至具备视觉能力的Qwen3.6 Plus模型。适用于需要低成本或免费使用先进语言及图像处理模型的开发者或企业，特别是那些希望通过Claude平台访问OpenCode提供的多种AI模型的用户。",2,"2026-06-11 04:08:23","CREATED_QUERY"]