v1.1.1 - Automatic Backend Routing and Safe Log Previews
Automatic backend routing with unchanged client endpoints
codebuddy2api 1.1.1 keeps the original client URLs while selecting the correct domestic/international and CodeBuddy CLI/WorkBuddy backend automatically. It also hardens logging and request processing across all three protocols.
Highlights
- Keep
/v1/chat/completions,/v1/responses,/v1/messages, and/v1/models. No region prefix, renamed model, or additional client parameter is required. - Select credentials from their own declared model capabilities and use the selected account's matching backend and product identity headers. Shared models can rotate among eligible accounts; incompatible accounts never borrow another account's catalog or balance.
- Cache catalogs by account, tenant, region, product, and client version. Refresh newly imported credentials, preserve trusted same-account caches on transient failures, and reject unscoped legacy catalogs.
- Fix real token keepalive, persistent cooldowns, refresh/import races, and stale results after credential replacement. Model listings combine each account's own catalog with its own credit eligibility.
- Default to the newest 16 images per request, with configurable limits and an optional HTTP 413 rejection policy. Add a 32 MiB upstream request budget and bounded, redacted log previews.
- Replace the quadratic image-data URL log pattern with a linear scanner, preserving redaction behavior and byte budgets.
- Share transport and validation across Chat, Responses, and Messages. Retry connection establishment only once; do not replay an already-sent POST after an ambiguous disconnect or read/write timeout. Empty or incomplete upstream streams no longer appear as successful completions.
- Preserve reasoning and refusal text, support explicit non-streaming JSON responses, and normalize named tool choices without relaxing the selected-function constraint.
- Add optional one-time international WorkBuddy trial-credit claims, disabled by default, with persistent account-level completion and a minimum 24-hour retry interval.
- Provide
.env.examplewith reasonable defaults and synchronized English/Chinese usage and deployment guides.
Upgrade
Use 1.1.1 rather than the earlier 1.1.0 image. Keep existing /v1 client configuration, the writable auth/ directory, and .env; no client address change is needed. Anthropic SDK base URLs remain the server root because the SDK appends /v1/messages.
Legacy unscoped catalogs and unidentified balances are refreshed before use. Affected requests may briefly return HTTP 503 with Retry-After during synchronization. Do not roll back credential files or delete persistent state when upgrading.
Set stream: false explicitly for JSON responses or stream: true for SSE. Trial claims require CODEBUDDY2API_AUTO_TRIAL=true; they are off by default. Eligibility and actual credits are determined by the upstream; preserve auth/trial-ledger.json after enabling this option.
Docker
docker pull ghcr.io/maiphucgiang/codebuddy2api:1.1.1For published-image Compose deployments, set CODEBUDDY2API_IMAGE=ghcr.io/maiphucgiang/codebuddy2api:1.1.1 in .env, then run:
docker compose pull
docker compose up -d --no-buildThe template defaults to a local source build; use docker compose up -d --build for that workflow.
Release tags: 1.1.1, 1.1, 1, and latest. Development builds use edge and do not overwrite latest.
Validation
- 344 regression tests across 21 scripts pass locally and in the Python 3.12 container, covering automatic routing, per-account isolation, credential concurrency, limits, streaming, tool choices, trial persistence, and adversarial log inputs.
- Live Chat, Responses, and Messages requests pass through the unchanged
/v1endpoints in streaming and non-streaming modes, including named native tool calls. No returned tools were executed. - Live checks cover
cn-cli,cn-work, andintl-work;intl-clirouting and identity behavior are covered by isolated tests, not a live CLI account. - Verified combined model discovery, key rejection, local unknown-model rejection, default 17-to-16 image truncation, and release-image API paths.
- The reproduced 41.6 KB log input dropped from about 2 seconds to about 7 milliseconds; larger-input and operation-count regressions also pass.
- GitHub Actions passed and published
linux/amd64andlinux/arm64. Anonymous inspection confirms that1.1.1,1.1,1, andlatestshare the same manifest; the pulled image reports version 1.1.1 and revisionfaecc573e7fabb2982c7e369df9ea1a98c0e3947. - CodeQL reanalysis marks alert #14 as fixed; the default branch has no unresolved code-scanning alerts at publication.
- Trial claims were tested with mocks; no live trial was claimed. Windows runtime behavior was not independently exercised.
Thanks to Maquer/workbuddy-checkin for documenting the trial endpoint.
For personal learning only. Use only subscriptions and accounts you are authorized to access.