docs: clarify openai usage normalization

This commit is contained in:
Peter Steinberger
2026-04-04 11:32:44 +01:00
parent 10e0592ed0
commit 2ab1f1c054
4 changed files with 16 additions and 1 deletions

View File

@@ -107,7 +107,8 @@ Current bundled examples:
fetching
- `openai`: GPT-5.4 forward-compat fallback, direct OpenAI transport
normalization, Codex-aware missing-auth hints, Spark suppression, synthetic
OpenAI/Codex catalog rows, thinking/live-model policy, and
OpenAI/Codex catalog rows, thinking/live-model policy, usage-token alias
normalization (`input` / `output` and `prompt` / `completion` families), and
provider-family metadata
- `google` and `google-gemini-cli`: Gemini 3.1 forward-compat fallback and
modern-model matching; Gemini CLI OAuth also owns auth-profile token

View File

@@ -278,6 +278,9 @@ Event types currently emitted:
## Usage
`usage` is populated when the underlying provider reports token counts.
OpenClaw normalizes common OpenAI-style aliases before those counters reach
downstream status/session surfaces, including `input_tokens` / `output_tokens`
and `prompt_tokens` / `completion_tokens`.
## Errors

View File

@@ -198,6 +198,12 @@ OpenAI Responses), OpenClaw also attaches stable session and turn identity state
to requests so retries, reconnects, and SSE fallback stay aligned to the same
conversation identity.
OpenClaw also normalizes OpenAI usage counters across transport variants before
they reach session/status surfaces. Native OpenAI/Codex Responses traffic may
report usage as either `input_tokens` / `output_tokens` or
`prompt_tokens` / `completion_tokens`; OpenClaw treats those as the same input
and output counters for `/status`, `/usage`, and session logs.
You can set `agents.defaults.models.<provider/model>.params.transport`:
- `"sse"`: force SSE

View File

@@ -61,6 +61,11 @@ Other surfaces:
- **CLI:** `openclaw status --usage` and `openclaw channels list` show
normalized provider quota windows (`X% left`, not per-response costs).
Usage surfaces normalize common provider-native field aliases before display.
For OpenAI-family Responses traffic, that includes both `input_tokens` /
`output_tokens` and `prompt_tokens` / `completion_tokens`, so transport-specific
field names do not change `/status`, `/usage`, or session summaries.
## Cost estimation (when shown)
Costs are estimated from your model pricing config: