2 Commits

Author SHA1 Message Date
Alex Castillo González
bc9a289b3f fix(llm): report token usage from the Codex OAuth provider (#2797)
OpenAICodexProvider._request_codex called consume_sse without an
on_provider_event hook and built LLMResponse without usage, so Codex turns
were counted as 0 tokens/cost. Collect the terminal usage event and attach it
to the response, as the openai_compat Responses path already does.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-12-01 00:26:23 +08:00
Bingxi Zhao (Frank)
1edf1d7d77 test(llm): pin the Codex request body's flattened tool_choice
v1.6.5 already flattens a named Chat Completions tool choice for the
Responses wire (`convert_tool_choice`), but nothing asserted it at the
Codex provider boundary: the existing coverage stops at the converter and
at the openai-compatible/azure bodies.

Harvested from #1251, which re-fixed the same bug against an older base.
The tests are the part worth keeping — they drive `chat` and `chat_stream`
and check the outgoing body, so a future provider rewrite cannot silently
send the nested shape again.

Co-authored-by: ZJPex <3258236335@qq.com>
2026-09-07 23:51:35 +08:00