Skip to content

v1.1.2 - Zero-Cost Model Preference and Multiplier Discovery

Choose a tag to compare

@maiphucgiang maiphucgiang released this 11 Sep 23:26
· 132 commits to main since this release

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 example deepseek-v4.1-flash on 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/models next to the standard OpenAI fields: credits is the lowest multiplier across eligible sources (0.0 means zero-cost, null means no parseable multiplier was declared) and credits_by_profile breaks 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/models unchanged. 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.2

For 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-build

The 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-flash stays 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-flash and other x0.00 models 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/models returns 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/amd64 and linux/arm64. The published image reports version 1.1.2 and revision cd8fa8645ddf95ddaf818a4751b2b6ddf835c041, and the 1.1.2, 1.1, 1, and latest tags 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.