opencode-proxy

作者 betri28已验证

A python proxy that lets you use OpenCode Go subscription with Claude Code

12
Stars
4
Forks
Python
语言
2026/8/24
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/betri28/opencode-proxy

快速入门

使用 opencode-proxy 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

OpenCode-Proxy

A python proxy that lets you use OpenCode Go subscription with Claude Code.

image

Key Features

  • Anthropic-compatible Proxy — Acts as a drop-in replacement for the Anthropic API. Claude Code sends requests to the proxy, which translates and forwards them to the OpenCode Go upstream, then converts the response back to Anthropic format seamlessly.

  • Extended Thinking & Effort — Forwards thinking and budget_tokens parameters as-is to the upstream model. Also supports effort (low / medium / high) for models that use effort-based reasoning. Availability depends on the model.

  • Image & Document — Passes image, PDF, DOCX, and XLSX content blocks through to the upstream model. Whether these are actually processed depends on model support.

  • Web Search — Forwards web search tool calls to models that natively support it. Results are translated back to Anthropic's tool_result format for Claude Code compatibility.

Requirements

  • Python 3.11+

Installation

pip install -r requirements.txt

Docker

Build and run with Docker Compose:

docker compose up --build

Or with plain Docker:

docker build -t opencode-proxy .
docker run --rm -p 4000:4000 -p 8082:8082 --env-file .env -v ${PWD}/logs:/app/logs opencode-proxy

The container exposes both the API on 4000 and the dashboard on 8082, and persists the SQLite history database under logs/.

Configuration

Copy .env.example to .env and edit:

cp .env.example .env

Edit values in .env:

VariableDescriptionDefault
OPENCODE_PROXYProxy server``
OPENCODE_API_KEYAPI key for OpenCode``
OPUS_MAP_MODELModel for opus routekimi-k2.6
SONNET_MAP_MODELModel for sonnet routeglm-5.1
HAIKU_MAP_MODELModel for haiku routeminimax-m2.5

Claude Code Configuration

To use this proxy with Claude Code, add these environment variables to your shell configuration:

export ANTHROPIC_API_KEY="fake-key"
export ANTHROPIC_AUTH_TOKEN="fake"
export ANTHROPIC_BASE_URL="http://localhost:4000"

Or add them to your .env file:

ANTHROPIC_API_KEY=fake-key
ANTHROPIC_AUTH_TOKEN=fake
ANTHROPIC_BASE_URL=http://localhost:4000

Note: The proxy server must be running (python opencode.py) before using Claude Code.

Running

python opencode.py

Server will start:

Web Dashboard

The web interface has 2 tabs:

Token Stats

  • Overview: Input, Output, Cache, Success, Failed, Avg Duration
  • Charts: Token Distribution, Token % by Model, Requests % by Model
  • Detailed table by model image

Request History

  • Request logs with full info: time, model, duration, tokens, status
  • Filter by time: Today, 7 Days, 30 Days, Custom
  • Delete history: all or by date image

Common Features

  • Dark/Light theme (Dark by default)
  • Auto-refresh every 5 seconds
  • Time filter shared across both tabs

API Endpoints

MethodPathDescription
POST/v1/messagesProxy Anthropic format
POST/anthropic/v1/messagesProxy Anthropic format
POST/v1/messages/count_tokensEstimate token count for a request
GET/healthHealth check
GET/api/statsToken usage stats (supports from_date, to_date)
GET/api/logsTerminal logs
GET/api/historyRequest history from DB (supports from_date, to_date)
DELETE/api/historyDelete history (before or all=true)

Advanced Configuration

For other settings, edit config/settings.py:

  • PORT: API port (default 4000)
  • WEB_PORT: Web UI port (default 8082)
  • MODELS: Models and endpoints list, including per-model capability flags (supports_vision, supports_pdf, supports_office, web_search_tool, thinking_style)

Keyboard shortcuts (Terminal)

  • j/: Scroll down log
  • k/: Scroll up log
  • g: Go to top
  • G: Go to bottom
  • Ctrl+C: Exit

Project Structure

opencode.py              # Main FastAPI server
config/
  __init__.py            # Package exports
  settings.py            # Configuration (PROXY, API_KEY, MODELS, ROUTES)
dashboard/
  __init__.py            # Package exports
  api.py                 # Dashboard API endpoints (stats, logs, history)
  display.py             # Rich terminal display (token table, log panel)
static/
  index.html             # Dashboard UI
  styles.css             # Styling (dark/light theme)
  app.js                 # JavaScript
requirements.txt         # Python dependencies
.env.example             # Template environment configuration
.env                     # Environment configuration (gitignored)
.gitignore               # Git ignore rules
logs/                    # Runtime directory (auto-created)
  requests.db            # SQLite - request history

License

MIT

常见问题

What is opencode-proxy?

opencode-proxy is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by betri28. A python proxy that lets you use OpenCode Go subscription with Claude Code. It has 12 GitHub stars.

Is opencode-proxy safe to use?

Yes. opencode-proxy passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install opencode-proxy?

Clone the repository with "git clone https://github.com/betri28/opencode-proxy" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is opencode-proxy written in?

opencode-proxy is primarily written in Python. It is open-source under betri28 on GitHub, so you can review or fork the full source.

Are there alternatives to opencode-proxy?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh opencode-proxy against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情