Skip to content

fix(zen): read nested usage in non-stream responses#18127

Draft
kitlangton wants to merge 1 commit intodevfrom
fix/zen-openai-response-usage
Draft

fix(zen): read nested usage in non-stream responses#18127
kitlangton wants to merge 1 commit intodevfrom
fix/zen-openai-response-usage

Conversation

@kitlangton
Copy link
Contributor

Summary

  • extract non-stream usage from each provider's actual response shape instead of assuming every provider returns top-level usage
  • fix the OpenAI Responses path where usage can be nested under response.usage, which was causing Zen to throw before tracking or returning the response
  • add focused provider usage extraction tests and a debug log for responses that still arrive without any usage payload

Verification

  • bun test test/provider-usage.test.ts test/rateLimiter.test.ts
  • bun run --cwd packages/console/app typecheck

Extract usage from each provider's actual response shape so OpenAI Responses payloads nested under response.usage do not crash Zen's non-stream tracking path.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant