mirror of
https://github.com/zyycn/codex-proxy-rs.git
synced 2026-11-06 16:06:08 +00:00
Estimate gpt-image-2 generation and edit costs from the official standard API rates for text input, image input, cached input and image output. Emit calculated costs before image delivery while preserving raw responses. Leave unsupported models, invalid usage and ambiguous mixed cache totals unpriced. Mark calculated total-only amounts with an approximation sign. Validation: 1,107 related backend tests, workspace rustfmt and strict OpenAI/gateway-api Clippy. Replaying the previously verified live usage of 18 text input and 229 image output tokens yields exactly USD 0.00696. Co-authored-by: Codex <noreply@openai.com>