English (default) · 简体中文
Turn Tencent CloudBase / Hunyuan models into a local OpenAI-compatible API at
http://localhost:8765/v1, with a desktop control panel and multi-account billing routing. No WeChat DevTools required — one process, one port, works with any OpenAI-format client.
Hosted AI models behind Tencent's 小程序成长计划 (Growth Plan) token package can only be called through the CloudBase SDK — a plain HTTP call fails with AI_CHANNEL_NOT_ALLOWED. This project solves that by relaying through a CloudBase cloud function, then re-exposing everything as a standard OpenAI endpoint on localhost, so any agent can consume it.
Your agent (OpenAI format)
│ POST /v1/chat/completions
▼
damiao-proxy ── http://localhost:8765/v1 ──┐
│ │
├── ① CloudBase SDK (anonymous login) ──┤──▶ Hunyuan / Qwen models
└── ② Cloud function `ai-proxy` (HTTP) ─┘ (text · image · I2I)
- Channel ① — SDK direct call: supports streaming, function calling (FC) and
reasoning_content. Preferred. - Channel ② — Cloud function fallback: non-streaming, compatible with older deployments.
- OpenAI-compatible —
/v1/chat/completions(stream + non-stream),/v1/models,/v1/images/generations. - Desktop app — Electron shell with system tray, portable
.exebuild, port auto-release on exit. - React control panel — live model catalog, connectivity test, account manager, metrics & charts, image workspace, conversation history.
- Multi-account routing — Growth-Plan token account and resource-point account side by side; per-request account selection.
- Function calling —
tools/tool_choicepassthrough with an agent tool loop (maxIter). - Vision & resource bridge — image input routed to a vision-capable model; PDF / text files extracted and injected into the prompt.
- Image generation — text-to-image and image-to-image, with history and local caching.
- Encrypted local secrets —
apiKeyvalues are stored AES-256-GCM encrypted, derived from the machine fingerprint.
git clone https://github.com/deity6/damiao-proxy.git
cd damiao-proxy
npm install
cp config.example.json config.json # then fill in your CloudBase envId
node server.jsThen open http://localhost:8765/ for the control panel. On Windows you can also just double-click 启动代理.bat.
npm install # installs electron + electron-builder (devDependencies)
npm start # launch the desktop shell (--debug opens devtools)
npm run dist:portable # build a portable Windows .exe into release/| Field | Value |
|---|---|
| Base URL | http://localhost:8765/v1 |
| API Key | any string (e.g. free-ai) — not validated |
| Default model | hy3 |
Works with anything that speaks the OpenAI protocol: codex, claude-code-switch, WorkBuddy custom models, openai SDK clients, and so on.
curl http://localhost:8765/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer free-ai" \
-d '{"model":"hy3","messages":[{"role":"user","content":"Say hi in one sentence"}]}'from openai import OpenAI
client = OpenAI(base_url="http://localhost:8765/v1", api_key="free-ai")
r = client.chat.completions.create(
model="hy3",
messages=[{"role": "user", "content": "Say hi in one sentence"}],
)
print(r.choices[0].message.content)curl -N http://localhost:8765/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"hy3","stream":true,"messages":[{"role":"user","content":"Count to five"}]}'GET /v1/models returns the live list. Text and image generation share the same token package.
| Type | Model id | Group | Notes |
|---|---|---|---|
| Text | hy3 |
hunyuan-exp |
Hunyuan Hy3 (295B/21B MoE, 256K ctx). 3-level deep thinking + FC. Default |
| Text | hunyuan-free |
hunyuan-exp |
Friendly alias of hy3, same underlying model |
| Text | hy3-preview |
hunyuan-exp |
Preview entry, auto-routed to hy3 |
| Image | HY-Image-3.0-Plus-4090-Tob-v1.0 |
hunyuan-image |
Text-to-image (default), supports aspect ratio / revise / thinking |
| Image | HY-Image-v3.0-I2I-ToB-v1.0.1 |
hunyuan-image |
Image-to-image (reference image + prompt) |
| Image | hunyuan-image, hunyuan-image-v3.0-v1.0.4 |
hunyuan-image |
Retired upstream on 2026-07-15 — migrate to the v3.0 Plus model |
| Type | Model id | Vision | Thinking | FC |
|---|---|---|---|---|
| Text | hy3, hy3-preview |
– | ✅ | ✅ |
| Text | qwen3.5-flash, qwen3.5-plus |
✅ | flash ✗ / plus ✓ | ✅ |
| Text | hunyuan-role-latest, hy-role |
– | ✗ | ✅ |
| Text | hy-mt2-lite, hy-mt2-plus, hy-mt2-pro |
– | ✗ | ✗ |
| Image | HY-Image-3.0-Plus-4090-Tob-v1.0 (T2I), HY-Image-v3.0-I2I-ToB-v1.0.1 (I2I) |
– | – | – |
Image generation is always served through the cloud function (
hunyuan-imagegroup) — the gatewaycloudbasegroup returns403 AI_MODEL_NOT_SUPPORTEDfor images.
| Method | Path | Description |
|---|---|---|
POST |
/v1/chat/completions |
Chat completion, stream supported. Aliases: /chat/completions, /v1 |
GET |
/v1/models |
Live model catalog for the active account set |
POST |
/v1/images/generations |
Text-to-image and image-to-image |
| Method | Path | Description |
|---|---|---|
GET |
/api/status |
Service state, port, active account, environment info |
GET PUT |
/api/settings |
Read / update settings (port, defaults, bridges) |
POST |
/api/toggle |
Start or stop the proxy |
POST |
/api/test |
Connectivity test (text or image) |
GET POST |
/api/accounts |
List / create accounts |
PUT DELETE |
/api/accounts/:id |
Update / delete an account |
GET |
/api/accounts/trash |
Deleted accounts awaiting restore |
POST |
/api/accounts/:id/restore |
Restore a deleted account |
POST |
/api/accounts/test · /api/accounts/probe |
Test or probe an account's models |
GET PUT |
/api/changelog |
Changelog data |
GET |
/api/metrics |
Request / success / failure / token metrics |
GET POST |
/api/conversations |
Conversation list / create |
GET PUT DELETE |
/api/conversations/:id |
Read / update / delete a conversation |
POST |
/api/system/open-path · /api/system/pick-directory · /api/system/migrate-storage |
Filesystem helpers |
GET |
/api/logs |
Recent server logs |
GET |
/api/images/history · /api/images/:name |
Generated image history and files |
Copy config.example.json to config.json and fill in your own values. config.json is git-ignored — never commit it.
| Key | Meaning |
|---|---|
envId |
CloudBase environment ID |
functionName |
Cloud function name (default ai-proxy) |
deviceId |
Device identifier used for anonymous login |
port |
Local port (default 8765; auto-increments if occupied) |
defaultModel / modelAlias |
Real default model / the alias exposed to clients |
proxyEnabled |
Whether the proxy starts automatically |
visionBridge |
Route image inputs to a vision-capable model (eyeModel) |
resourceBridge |
Extract PDF / text attachments (maxFileBytes, eyeModel) |
agentTools |
Agent tool loop: enabled, unsafeTools, maxIter |
accounts |
Account list (type: token | resource) |
routing.defaultAccount |
Default account id |
The relay cloud function lives in cloudfunctions/ai-proxy.
cd cloudfunctions/ai-proxy
npm install
# set your own envId in cloudbaserc.json, then deploy with tcb / CloudBase CLIRequirements: Nodejs 18.15 runtime, anonymous login enabled, security rule allowing anonymous invocation of ai-proxy only.
# Control panel (Vite + React)
cd ui
npm install
npm run dev # dev server
npm run build # build to ../dist, served automatically by server.js
# Portable desktop build
npm run dist:portabledamiao-proxy/
├── server.js # HTTP server: OpenAI endpoints + control-panel API + account routing
├── electron-main.js # Electron shell, tray icon, port lifecycle
├── preload.js # Renderer bridge
├── models.js # Data-driven model catalog (token / resource-point)
├── config.example.json # Config template (no secrets)
├── changelog.json # Version history (source of CHANGELOG.md)
├── 启动代理.bat # Windows one-click launcher
├── launcher.ps1 # PowerShell launcher
├── assets/ # Icon, tray icon, splash
├── ui/ # React control panel (Vite)
├── mcp/ # Optional MCP server for image generation
└── cloudfunctions/
└── ai-proxy/ # CloudBase relay function (text + image)
- Everything runs locally. No telemetry, no third-party analytics.
- Account
apiKeyvalues are encrypted with AES-256-GCM using a machine-derived key; copied files cannot be decrypted elsewhere. config.json,data/,rp-key.txtand all logs are git-ignored by default.- Model prompts and responses go to Tencent CloudBase — follow their terms when using Growth-Plan tokens.
hy3relayed through the proxy may return an emptycontentwith onlyreasoning_contentpopulated — an upstream quirk, not a proxy bug.hunyuan-2.0-instructdoes not support function calling natively; usehy3if you need tools.- Image generation returns
422when the upstream content filter rejects a prompt — rephrase and retry. - The gateway (
cloudbase) channel does not serve image models; images always go through the cloud function.
See CHANGELOG.md.
MIT — see LICENSE.
This is an unofficial personal project. It is not affiliated with Tencent CloudBase or Hunyuan. Use it in compliance with the platform's terms of service.