Skip to content

Fix xAI usage accounting blocking Orion deployment - #7

Merged
euforic merged 1 commit into
mainfrom
euforic/fix-orion-xai-usage
Sep 29, 2026
Merged

euforic merged 1 commit into
mainfrom
euforic/fix-orion-xai-usage

Conversation

@euforic

@euforic euforic commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

The Orion deployment validation fails for xAI chat responses that report visible completion tokens separately from reasoning tokens: the fork retains normalizeXAIChatUsage, but unary and streaming chat entrypoints only normalize provider cost. Both existing deployment assertions see 5 completion tokens instead of 56 (5 visible + 51 reasoning), so image publication never starts.

Route both entrypoints through the existing idempotent usage normalizer, retaining provider-reported cost. Add a pure streaming regression and two live-harness cases for unary and terminal SSE token totals.

Validation: the new pure regression failed before the fix with 5 versus 56 completion tokens and passes afterward. Existing pure normalization/cost regressions pass. Gateway/provider builds pass. Harness augmentation and xAI filtering retain exactly two cases. The existing Orion workflow will validate the full provider-account implementation before building/promoting an immutable image. Paid live provider inference remains an operator check.

make dev PORT=8081 APP_DIR=$(pwd)/tests/integrations/python
make run-provider-harness-test PROVIDER=xai FEATURE="reasoning usage normalization" BASE_URL=http://localhost:8081

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@euforic
euforic merged commit 38b22c3 into main Sep 29, 2026
4 of 8 checks passed
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