Add support for token usage reporting for Azure endpoint

Resolved 💬 4 comments Opened Sep 6, 2025 by eugene-kim Closed Feb 12, 2026
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.29.0

Which model were you using?

gpt-5

What platform is your computer?

Darwin 24.6.0 arm64 arm

What steps can reproduce the bug?

Use an azure deployment. Here's my config.toml (deployment name redacted):

model_provider = "azure"
model = "gpt-5"

[model_providers.azure]
name = "Azure"
base_url = "https://redacted.openai.azure.com/openai/deployments/gpt-5"
env_key = "AZURE_OPENAI_API_KEY"
query_params = { api-version = "2024-12-01-preview" }
# wire_api = "chat"
model_reasoning_summary = "detailed"

What is the expected behavior?

I should see tokens used in the session after I send messages.

What do you see instead?

📂 Workspace
  • Path: ~/Projects/ti
  • Approval Mode: on-request
  • Sandbox: workspace-write
  • AGENTS files: AGENTS.md

🧠 Model
  • Name: gpt-5
  • Provider: Azure

📊 Token Usage
  • Session ID: a249b4c6-57e0-4a3c-8288-428ee9b323de
  • Input: 0
  • Output: 0
  • Total: 0

Additional information

I also don't see context remaining either.

View original on GitHub ↗

4 Comments

bro4all · 11 months ago

out of the scope of this bug probably, but are you able to set the reasoning effort through /model ?

eugene-kim · 11 months ago

Yes

On Sun, Sep 7, 2025 at 8:54 PM Omar Habra @.***> wrote:

bro4all left a comment (openai/codex#3250) <https://github.com/openai/codex/issues/3250#issuecomment-3264237243> out of the scope of this bug probably, but are you able to set the reasoning effort through /model ? — Reply to this email directly, view it on GitHub <https://github.com/openai/codex/issues/3250#issuecomment-3264237243>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAHJHUKXVFPZZAHWPJZEIST3RTHTJAVCNFSM6AAAAACFZOBVCOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTENRUGIZTOMRUGM> . You are receiving this because you authored the thread.Message ID: @.***>
etraut-openai contributor · 8 months ago

Token usage reporting and accounting are handled differently by Microsoft and OpenAI. The codex CLI currently supports the OpenAI mechanism for token reporting. To make this work with Azure endpoints, the Azure team would need to publish and document a mechanism for token usage reporting.

I've changed this from a bug report to an enhancement request.

etraut-openai contributor · 6 months ago

This feature request hasn't received enough upvotes in the past two months, so I'm going to close it.