v1.1.2 - Zero-Cost Model Preference and Multiplier Discovery
Zero-cost model preference and multiplier discovery
codebuddy2api 1.1.2 routes same-name models to the cheapest known source and publishes each catalog multiplier on /v1/models, so clients can see which models are free on which backend.
Highlights
- Prefer accounts whose own catalog declares the requested model as zero-multiplier (
credits: x0.00, for exampledeepseek-v4.1-flashon international WorkBuddy). Least-expiring-credit rotation still applies inside the preferred group, and a sticky session is rebound only when a better source becomes available. - Drop accounts with a known zero balance from paid-model rotation instead of letting them fail on empty credit. They keep serving the zero-multiplier models their own catalog declares, and rejoin automatically once the balance recovers. Unknown balances keep the previous permissive behavior.
- Expose multipliers on
/v1/modelsnext to the standard OpenAI fields:creditsis the lowest multiplier across eligible sources (0.0means zero-cost,nullmeans no parseable multiplier was declared) andcredits_by_profilebreaks it down per product, for example{"intl-work": 0.0, "cn-cli": 0.03}. Clients may ignore both extension fields. - Keep
/v1/chat/completions,/v1/responses,/v1/messages, and/v1/modelsunchanged. No client address, model name, or extra parameter changes are required. - Cooldown semantics are unchanged: a 429 only cools the affected account and model until the upstream reset time, and an already-sent POST is never replayed against another account.
Upgrade
Use 1.1.2 rather than 1.1.1. Keep existing /v1 client configuration, the writable auth/ directory, and .env. Model catalogs and balances are read from the existing per-account state; no migration is needed.
Multiplier values come from each account's own cached catalog (auth/model-catalog.json, 6-hour TTL). A model shows null until a parseable multiplier is available, and zero-balance accounts contribute only their zero-multiplier entries.
Docker
docker pull ghcr.io/maiphucgiang/codebuddy2api:1.1.2For published-image Compose deployments, set CODEBUDDY2API_IMAGE=ghcr.io/maiphucgiang/codebuddy2api:1.1.2 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.2, 1.1, 1, and latest. Development builds use edge and do not overwrite latest.
Validation
- 346 regression tests across 21 scripts pass locally and in the Python 3.12 container, including new coverage for multiplier parsing, per-profile aggregation, zero-multiplier preference, sticky rebinding, and zero-balance eligibility.
- Live international requests confirm
deepseek-v4.1-flashstays free: the upstream usage field, the official usage records, and the account balance all report zero credits, while paid models on the same account still deduct credits. - Live routing checks show
deepseek-v4.1-flashand otherx0.00models selecting the international WorkBuddy accounts first, and paid models (fast-model,glm-5.3) keeping their previous rotation. - A live account-level frequency limit (code 6004) cools only that account and model until the reported reset time; the remaining international accounts keep serving the same model without interruption.
/v1/modelsreturns all 31 discovered models with multipliers resolved from the real account catalogs, including three zero-cost entries.- GitHub Actions passed on the release tag and published
linux/amd64andlinux/arm64. The published image reports version 1.1.2 and revisioncd8fa8645ddf95ddaf818a4751b2b6ddf835c041, and the1.1.2,1.1,1, andlatesttags share the same manifest. - The default branch has no unresolved code-scanning alerts at publication.
For personal learning only. Use only subscriptions and accounts you are authorized to access.