Repository navigation
feat(openai): trace svg image output, svg_usage, and new 3.46 params - #1089
Open
Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit into
Open
Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit into
Abhijeet Prasad (AbhiPrasad) wants to merge 1 commit into
Conversation
> 🤖 **This text was AI-generated.** openai 3.46.0 (pinned as `latest` in #1082) added SVG output for image generation and a few new request params. Our tracing didn't handle them: - SVG images were logged with a made-up MIME type, because we built it as `image/{output_format}`: ``` output_format="svg" -> image/svg (wrong, unknown to mimetypes) -> image/svg+xml (now) ``` - `svg_usage` (token usage of the model that writes the SVG, reported separately from the image model's `usage`) was dropped. - `complexity`, `frame_count`, `frame_duration_ms`, `svg` (Images) and `image`, `prompt_cache_options` (Responses) were missing from span metadata. Now: - `_image_attachment_from_base64` lives in `integrations/utils.py` and maps `svg` to `image/svg+xml` (and a `.svg` filename). OpenAI and LiteLLM both use it, so LiteLLM-proxied SVG images are fixed too. - `svg_usage` is logged verbatim as metadata, not metrics. Only standard metric keys are allowed, and the SVG author can be a different model (e.g. `gpt-5.6-sol`), so folding its tokens into the image model's totals would misprice the span: ``` images.generate span responses.create (llm span) metrics: prompt_tokens ... └─ image_generation_call (tool span) metadata: svg_usage {...} metadata: svg_usage {...} ``` - The new params are added to the Images and Responses metadata allowlists. The new cassette tests are gated to openai >= 3.46.0, since older matrix versions don't support SVG output. Responses `image_generation_call` results are still logged as raw base64 rather than attachments (true for every image format, not just SVG); that's a possible follow-up. Closes #1084
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Luca Forstner (lforst)
approved these changes
Nov 9, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
openai 3.46.0 (pinned as
latestin #1082) added SVG output for image generation and a few new request params. Our tracing didn't handle them:SVG images were logged with a made-up MIME type, because we built it as
image/{output_format}:svg_usage(token usage of the model that writes the SVG, reported separately from the image model'susage) was dropped.complexity,frame_count,frame_duration_ms,svg(Images) andimage,prompt_cache_options(Responses) were missing from span metadata.Now:
_image_attachment_from_base64lives inintegrations/utils.pyand mapssvgtoimage/svg+xml(and a.svgfilename). OpenAI and LiteLLM both use it, so LiteLLM-proxied SVG images are fixed too.svg_usageis logged verbatim as metadata, not metrics. Only standard metric keys are allowed, and the SVG author can be a different model (e.g.gpt-5.6-sol), so folding its tokens into the image model's totals would misprice the span:The new params are added to the Images and Responses metadata allowlists.
The new cassette tests are gated to openai >= 3.46.0, since older matrix versions don't support SVG output. Responses
image_generation_callresults are still logged as raw base64 rather than attachments (true for every image format, not just SVG); that's a possible follow-up.Closes #1084