-
-
Notifications
You must be signed in to change notification settings - Fork 0
feat:Switch image generation endpoints to JSON using OpenAIImagesGenerationsIn #221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe OpenAPI spec updates two image generation endpoints to accept application/json bodies using the shared OpenAIImagesGenerationsIn schema. Legacy form-encoded request bodies and their dedicated Body_* schemas are removed. No other endpoints or components are modified. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant API as DeepInfra API
participant S as Image Generation Service
rect rgba(200,200,255,0.2)
note over C,API: Old (before change)
C->>API: POST /v1/.../images/generations<br/>Content-Type: application/x-www-form-urlencoded
API->>API: Parse form fields
API->>S: Invoke generation(params)
S-->>API: Image result
API-->>C: 200 OK (image payload)
end
rect rgba(200,255,200,0.2)
note over C,API: New (after change)
C->>API: POST /v1/.../images/generations<br/>Content-Type: application/json<br/>Body: OpenAIImagesGenerationsIn
API->>API: Validate JSON against OpenAIImagesGenerationsIn
API->>S: Invoke generation(params)
S-->>API: Image result
API-->>C: 200 OK (image payload)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (9)
src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.OpenaiImagesGenerations.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.DeepInfraClient.OpenaiImagesGenerations2.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.OpenaiImagesGenerations.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.IDeepInfraClient.OpenaiImagesGenerations2.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.JsonSerializerContextTypes.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.BodyOpenaiImagesGenerationsV1ImagesGenerationsPost.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.BodyOpenaiImagesGenerationsV1ImagesGenerationsPost.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.BodyOpenaiImagesGenerationsV1OpenaiImagesGenerationsPost.Json.g.csis excluded by!**/generated/**src/libs/DeepInfra/Generated/DeepInfra.Models.BodyOpenaiImagesGenerationsV1OpenaiImagesGenerationsPost.g.csis excluded by!**/generated/**
📒 Files selected for processing (1)
src/libs/DeepInfra/openapi.yaml(2 hunks)
🔇 Additional comments (1)
src/libs/DeepInfra/openapi.yaml (1)
2183-2187: Ignore this suggestion: the primary/v1/images/generationsendpoint only supportsapplication/json, so addingapplication/x-www-form-urlencodedjust on the alias/v1/openai/images/generationswould introduce inconsistent behavior. Neither endpoint includes anexamplesblock—if you want examples, add them to both, otherwise drop this diff.Likely an incorrect or invalid review comment.
| content: | ||
| application/x-www-form-urlencoded: | ||
| application/json: | ||
| schema: | ||
| $ref: '#/components/schemas/Body_openai_images_generations_v1_images_generations_post' | ||
| $ref: '#/components/schemas/OpenAIImagesGenerationsIn' | ||
| required: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Breaking change: switched to JSON body — consider dual content-type or clear deprecation/versioning
Changing /v1/images/generations to application/json will break existing clients posting form-encoded bodies. Either (a) support both content types for a deprecation window, or (b) bump API version and publish migration notes.
Proposed minimal dual support + example:
requestBody:
content:
- application/json:
+ application/json:
schema:
$ref: '#/components/schemas/OpenAIImagesGenerationsIn'
+ examples:
+ basic:
+ value:
+ model: black-forest-labs/FLUX-1-schnell
+ prompt: A photo of an astronaut riding a horse on Mars.
+ n: 1
+ response_format: b64_json
+ size: 1024x1024
+ application/x-www-form-urlencoded:
+ schema:
+ $ref: '#/components/schemas/OpenAIImagesGenerationsIn'To find impacted callers and docs:
🏁 Script executed:
#!/bin/bash
# Find form-encoded usage of images generations
rg -n -C2 -iP '/v1/(openai/)?images/generations' && rg -n -i 'application/x-www-form-urlencoded|multipart/form-data' -g '!**/node_modules/**' -g '!**/dist/**'Length of output: 3071
🏁 Script executed:
#!/bin/bash
# Locate the /v1/images/generations endpoint and print its requestBody section
LINE=$(grep -n '^ /v1/images/generations:' src/libs/DeepInfra/openapi.yaml | cut -d: -f1)
echo "Endpoint defined at line $LINE"
sed -n "${LINE},$((LINE+50))p" src/libs/DeepInfra/openapi.yamlLength of output: 1759
src/libs/DeepInfra/openapi.yaml – /v1/images/generations requestBody now only accepts application/json
This is a breaking change: existing clients posting form-encoded bodies will fail. Either restore support for application/x-www-form-urlencoded (and multipart/form-data) during a deprecation window, or bump the API version and publish migration notes.
🤖 Prompt for AI Agents
In src/libs/DeepInfra/openapi.yaml around lines 2138 to 2142 the requestBody for
the /v1/images/generations endpoint currently only lists application/json which
breaks clients sending form-encoded or multipart data; restore backward
compatibility by adding application/x-www-form-urlencoded and
multipart/form-data entries under content with appropriate schema refs (or a
form schema with properties matching OpenAIImagesGenerationsIn), mark the
JSON-only change as deprecated and document a deprecation window; alternatively,
if you intend to break compatibility, bump the API version in the spec and add
migration notes in the documentation and changelog explaining required client
changes.
Summary by CodeRabbit
Note: If you integrate with the image generation endpoints, update your requests to JSON to avoid failures.