Skip to content

Commit 8146a80

Browse files
feat: update image generation model configuration
- Change model from dall-e-2 to gpt-image-1-mini in README and tests - Update model key constants in test files to use proper API constants Signed-off-by: Hrushikesh Patil <[email protected]>
1 parent a82eee1 commit 8146a80

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

cmd/aigw/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Here are values we use for Ollama:
7474
-X POST http://localhost:1975/v1/images/generations \
7575
-H "Authorization: Bearer unused" \
7676
-H "Content-Type: application/json" \
77-
-d '{"model":"gpt-image-1-mini","prompt":"A watercolor painting of a red fox in a birch forest","size":"1024x1024","quality":"low"}' \
77+
-d '{"model":"gpt-image-1-mini","prompt":"A watercolor painting of a red fox in a birch forest","size":"1024x1024","quality":"low"}' \
7878
| jq -r '.data[0].b64_json' | base64 -d > image.png
7979
```
8080

internal/extproc/imagegeneration_processor_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func Test_imageGenerationProcessorRouterFilter_ProcessRequestBody(t *testing.T)
109109

110110
t.Run("ok", func(t *testing.T) {
111111
headers := map[string]string{":path": "/v1/images/generations"}
112-
const modelKey = "x-ai-gateway-model-key"
112+
const modelKey = "x-ai-eg-model"
113113
p := &imageGenerationProcessorRouterFilter{
114114
config: &processorConfig{},
115115
requestHeaders: headers,
@@ -246,7 +246,7 @@ func Test_imageGenerationProcessorUpstreamFilter_ProcessResponseBody(t *testing.
246246
},
247247
},
248248
},
249-
requestHeaders: map[string]string{"x-aigw-model": "ai_gateway_llm"},
249+
requestHeaders: map[string]string{internalapi.ModelNameHeaderKeyDefault: "ai_gateway_llm"},
250250
responseHeaders: map[string]string{":status": "200"},
251251
backendName: "some_backend",
252252
modelNameOverride: "ai_gateway_llm",
@@ -261,16 +261,16 @@ func Test_imageGenerationProcessorUpstreamFilter_ProcessResponseBody(t *testing.
261261

262262
md := res.DynamicMetadata
263263
require.NotNil(t, md)
264-
require.Equal(t, float64(123), md.Fields["ai_gateway_llm_ns"].
264+
require.Equal(t, float64(123), md.Fields[internalapi.AIGatewayFilterMetadataNamespace].
265265
GetStructValue().Fields["output_token_usage"].GetNumberValue())
266-
require.Equal(t, float64(1), md.Fields["ai_gateway_llm_ns"].
266+
require.Equal(t, float64(1), md.Fields[internalapi.AIGatewayFilterMetadataNamespace].
267267
GetStructValue().Fields["input_token_usage"].GetNumberValue())
268-
require.Equal(t, float64(54321), md.Fields["ai_gateway_llm_ns"].
268+
require.Equal(t, float64(54321), md.Fields[internalapi.AIGatewayFilterMetadataNamespace].
269269
GetStructValue().Fields["cel_int"].GetNumberValue())
270-
require.Equal(t, float64(9999), md.Fields["ai_gateway_llm_ns"].
270+
require.Equal(t, float64(9999), md.Fields[internalapi.AIGatewayFilterMetadataNamespace].
271271
GetStructValue().Fields["cel_uint"].GetNumberValue())
272-
require.Equal(t, "ai_gateway_llm", md.Fields["ai_gateway_llm_ns"].GetStructValue().Fields["model_name_override"].GetStringValue())
273-
require.Equal(t, "some_backend", md.Fields["ai_gateway_llm_ns"].GetStructValue().Fields["backend_name"].GetStringValue())
272+
require.Equal(t, "ai_gateway_llm", md.Fields[internalapi.AIGatewayFilterMetadataNamespace].GetStructValue().Fields["model_name_override"].GetStringValue())
273+
require.Equal(t, "some_backend", md.Fields[internalapi.AIGatewayFilterMetadataNamespace].GetStructValue().Fields["backend_name"].GetStringValue())
274274
})
275275

276276
// Verify we record failure for non-2xx responses and do it exactly once (defer suppressed).

tests/internal/testopenai/cassettes/image-generation-basic.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ interactions:
66
proto: HTTP/1.1
77
proto_major: 1
88
proto_minor: 1
9-
content_length: 105
9+
content_length: 139
1010
host: api.openai.com
11-
body: "{\n \"model\": \"dall-e-2\",\n \"prompt\": \"A simple black-and-white line drawing of a cat playing with yarn\"\n}"
11+
body: "{\n \"model\": \"gpt-image-1-mini\",\n \"prompt\": \"A simple black-and-white line drawing of a cat playing with yarn\",\n \"size\": \"1024x1024\",\n \"quality\": \"low\"\n}"
1212
headers:
1313
Accept-Encoding:
1414
- gzip
1515
Content-Length:
16-
- "105"
16+
- "139"
1717
Content-Type:
1818
- application/json
1919
User-Agent:
@@ -25,22 +25,22 @@ interactions:
2525
proto_major: 2
2626
proto_minor: 0
2727
content_length: 544
28-
body: "{\n \"created\": 1759925706,\n \"data\": [\n {\n \"url\": \"https://oaidalleapiprodscus.blob.core.windows.net/private/org-lKxIBdltrjcFbzboW0t1hthB/user-EdKNxj0PjYS29CfjUcR77ybc/img-MigVWgAi6l5W3B31L6imFob3.png?st=2025-10-08T11%3A15%3A05Z&se=2025-10-08T13%3A15%3A05Z&sp=r&sv=2024-08-04&sr=b&rscd=inline&rsct=image/png&skoid=52f8f7b3-ca8d-4b21-9807-8b9df114d84c&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2025-10-08T12%3A15%3A05Z&ske=2025-10-09T12%3A15%3A05Z&sks=b&skv=2024-08-04&sig=ex3I6RoFVH9hfNst8oloGtfBVA3o2aXvTI4cFtLVzlE%3D\"\n }\n ]\n}"
28+
body: "{\n \"created\": 1760092079,\n \"data\": [\n {\n \"url\": \"https://oaidalleapiprodscus.blob.core.windows.net/private/org-lKxIBdltrjcFbzboW0t1hthB/user-EdKNxj0PjYS29CfjUcR77ybc/img-3Ah2ERYmeJLYrRlxnuWPFpXG.png?st=2025-10-10T09%3A27%3A58Z&se=2025-10-10T11%3A27%3A58Z&sp=r&sv=2024-08-04&sr=b&rscd=inline&rsct=image/png&skoid=475fd488-6c59-44a5-9aa9-31c4db451bea&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2025-10-10T10%3A27%3A58Z&ske=2025-10-11T10%3A27%3A58Z&sks=b&skv=2024-08-04&sig=IlzMauzcIHqE5/JLQsiMglI0mqbGlrpQC/mvJz4TYuc%3D\"\n }\n ]\n}"
2929
headers:
3030
Alt-Svc:
3131
- h3=":443"; ma=86400
3232
Cf-Cache-Status:
3333
- DYNAMIC
3434
Cf-Ray:
35-
- 98b58f7bde648af7-BOM
35+
- 98c56d4f2dd889f6-BOM
3636
Content-Length:
3737
- "544"
3838
Content-Type:
3939
- application/json
4040
Date:
41-
- Wed, 08 Oct 2025 12:15:06 GMT
41+
- Fri, 10 Oct 2025 10:27:59 GMT
4242
Openai-Processing-Ms:
43-
- "13265"
43+
- "13023"
4444
Openai-Project:
4545
- proj_Ro6stNUOKIiLVqRr1zdjaFoh
4646
Openai-Version:
@@ -52,9 +52,9 @@ interactions:
5252
X-Content-Type-Options:
5353
- nosniff
5454
X-Envoy-Upstream-Service-Time:
55-
- "13269"
55+
- "13027"
5656
X-Request-Id:
57-
- req_c643aaa7f52258b2192d4c133d117e43
57+
- req_54999507941c487a8f1997287aaa8cf6
5858
status: 200 OK
5959
code: 200
60-
duration: 13.632879292s
60+
duration: 14.290895958s

0 commit comments

Comments
 (0)