Route Seedream 4.5 image flows through the NewAPI generations endpoint

Seedream image generation in the server was still split across the generic text2image path and the legacy multipart image edit path. That shape does not match Volcengine Seedream 4.5, which expects JSON requests to /v1/images/generations for both text2image and img2img, with reference images carried through the image field.

Constraint: Seedream 4.5 and 5.0 use /v1/images/generations rather than the older multipart /v1/images/edits contract
Constraint: Existing Gemini and other image routes must keep their current behavior unchanged
Rejected: Keep using /v1/images/edits for Seedream img2img | upstream rejects the request body shape
Rejected: Special-case the CLI input contract | the server route adapter owns upstream normalization
Confidence: high
Scope-risk: moderate
Reversibility: clean
Directive: Keep Seedream routes on the JSON generations path; do not reintroduce multipart edits for these models without revalidating the upstream API contract
Tested: go test ./internal/server; go test ./...; go build -o /tmp/popiartserver-verify ./cmd/popiartserver; test-server txt2img/img2img/img2video smoke with Seedream 4.5 + Vidu
Not-tested: Seedream 5.0 live smoke against the test server
This commit is contained in:
wtgoku
2026-04-10 17:40:49 +08:00
parent b99c49790a
commit 214ffa1dfc
3 changed files with 274 additions and 2 deletions
+14 -2
View File
@@ -22,6 +22,7 @@ func TestHandleModelsLoadsDynamicCatalogFromNewAPI(t *testing.T) {
"success": true,
"data": [
{"id":"gpt-image-1","owned_by":"openai","supported_endpoint_types":["image-generation"]},
{"id":"seedream-4-5-251128","owned_by":"custom","supported_endpoint_types":[]},
{"id":"sora-2","owned_by":"openai","supported_endpoint_types":["openai-video"]},
{"id":"viduq2","owned_by":"custom","supported_endpoint_types":[]},
{"id":"custom-i2v-preview","owned_by":"custom","supported_endpoint_types":[]},
@@ -73,8 +74,8 @@ func TestHandleModelsLoadsDynamicCatalogFromNewAPI(t *testing.T) {
if !resp.OK {
t.Fatalf("expected ok response, got %s", rec.Body.String())
}
if len(resp.Data.Items) != 4 {
t.Fatalf("expected 4 supported media models, got %d: %s", len(resp.Data.Items), rec.Body.String())
if len(resp.Data.Items) != 5 {
t.Fatalf("expected 5 supported media models, got %d: %s", len(resp.Data.Items), rec.Body.String())
}
byID := make(map[string]model, len(resp.Data.Items))
@@ -99,6 +100,17 @@ func TestHandleModelsLoadsDynamicCatalogFromNewAPI(t *testing.T) {
t.Fatalf("unexpected image capabilities: %#v", imageModel.Capabilities)
}
seedreamModel, exists := byID["seedream-4-5-251128"]
if !exists {
t.Fatal("expected seedream-4-5-251128 in dynamic model list")
}
if seedreamModel.Type != "image" {
t.Fatalf("expected seedream-4-5-251128 type image, got %q", seedreamModel.Type)
}
if len(seedreamModel.Capabilities) != 2 || seedreamModel.Capabilities[0] != "text2image" || seedreamModel.Capabilities[1] != "img2img" {
t.Fatalf("unexpected seedream capabilities: %#v", seedreamModel.Capabilities)
}
videoModel, exists := byID["sora-2"]
if !exists {
t.Fatal("expected sora-2 in dynamic model list")