Skip to content

fix(ai): omit the default service tier, reprice cache writes from message_delta, repoint the zai default - #2032

Open
snimu wants to merge 1 commit into
mainfrom
fix/provider-wire-defects
Open

fix(ai): omit the default service tier, reprice cache writes from message_delta, repoint the zai default#2032
snimu wants to merge 1 commit into
mainfrom
fix/provider-wire-defects

Conversation

@snimu

@snimu snimu commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Three provider wire/pricing defects:

Validation

  • four pins, each verified fail-unfixed: default-tier omission on the OpenAI Responses body and on the Codex body (one per wire builder), message_delta breakdown repricing (exact-cost assertion), and per-provider default catalog existence
  • suites: anthropic-sse-parsing (7), openai-responses-copilot-provider (24), openai-codex-stream (18), model-resolver (25) — all green, sanitized env
  • root npm run check passes via the pre-commit hook

LOC

Src +20/−3 across four files (all point fixes; the only added mechanism is the 8-line delta reprice mirroring the existing message_start path). Tests +143/−2, changelog 2 fragments.

Linear: RES-1266 https://linear.app/primeintellect/issue/RES-1266


Note

Low Risk
Targeted provider request shaping and usage-cost fixes plus a default model ID update; no auth or broad API redesign.

Overview
Fixes three wire/pricing/defaults issues across pi-ai and coding-agent.

OpenAI Responses and Codex no longer put service_tier on the request body when the tier is "default". Omitting the field is the real default; sending it explicitly breaks strict proxies (e.g. GitHub Copilot). Non-default tiers (flex, priority) are unchanged.

Anthropic streaming now recomputes cache-write cost on message_delta when usage includes a cache_creation breakdown (5m vs 1h), matching the message_start path. Final token counts from the delta no longer get billed at a stale rate from the start event.

zai default model moves from glm-5.1 (removed from the catalog) to glm-5.3. A test asserts every defaultModelPerProvider entry exists in the catalog so future drift fails in CI instead of silently falling back to a template model.

Reviewed by Cursor Bugbot for commit 64e5f3d. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Omit default service_tier on OpenAI requests, reprice Anthropic cache writes from message_delta, point zai default to glm-5.3

  • Omits service_tier from OpenAI Responses and Codex request bodies when the tier is "default"; explicitly requested non-default tiers are still serialized.
  • Anthropic streaming now reads the cache-creation breakdown from message_delta usage and recalculates cache-write cost using the configured five-minute or one-hour retention tier, replacing the earlier message_start-derived price.
  • Changes the zai provider default model from glm-5.1 to glm-5.3 in model-resolver.ts.
  • Risk: Anthropic cache-write cost now depends on message_delta containing the cache-creation breakdown; if a response omits it, cache-write cost may be zero or stale. zai consumers relying on glm-5.1 as the default will silently move to glm-5.3.

Macroscope summarized 64e5f3d.

…tes from message_delta, and repoint the zai default model

Sending service_tier: "default" explicitly breaks strict endpoints (Copilot rejects it) while meaning nothing to OpenAI, so both Responses wire builders omit it. Anthropic message_delta events that carry a cache_creation breakdown reprice the cache-write rate the same way message_start does, instead of billing new tokens at the stale initial rate. The zai default model glm-5.1 no longer exists in the catalog and silently degraded to a fallback template; the default is now glm-5.3 and a catalog-existence test turns future default drift into a CI failure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant