mirror of
https://github.com/mudler/LocalAI
synced 2026-05-24 09:28:23 +00:00
* fix: Add usage fields to image generation response for OpenAI API compatibility Fixes #7354 Added input_tokens, output_tokens, and input_tokens_details fields to the image generation API response to comply with OpenAI's image generation API specification. This resolves validation errors in LiteLLM and the OpenAI SDK. Changes: - Added InputTokensDetails struct with text_tokens and image_tokens fields - Extended OpenAIUsage struct with input_tokens, output_tokens, and input_tokens_details - Updated ImageEndpoint to populate usage object with required fields - Updated InpaintingEndpoint to populate usage object with required fields - All fields initialized to 0 as per current behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: majiayu000 <1835304752@qq.com> * fix: Correct usage field types for image generation API compatibility Changed InputTokens and OutputTokens from pointer types (*int) to regular int types to match OpenAI API specification. This fixes validation errors with LiteLLM and OpenAI SDK when parsing image generation responses. Fixes #7354 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> Signed-off-by: majiayu000 <1835304752@qq.com> --------- Signed-off-by: majiayu000 <1835304752@qq.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| endpoints | ||
| middleware | ||
| routes | ||
| static | ||
| views | ||
| app.go | ||
| app_test.go | ||
| explorer.go | ||
| http_suite_test.go | ||
| openai_mapping_test.go | ||
| openai_videos_test.go | ||
| render.go | ||