From 226fc2cf8f6ac15267f1ec8265aeb92678b74237 Mon Sep 17 00:00:00 2001 From: Resurgamz <108165585+Resurgamz@users.noreply.github.com> Date: Tue, 9 Jun 2026 10:26:06 +0800 Subject: [PATCH] fix(azure): route image edits by model deployment Fixes #1917 --- src/resources/images.ts | 8 +++++++- tests/lib/azure.test.ts | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/resources/images.ts b/src/resources/images.ts index ece51889e7..0aef5881b6 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -55,7 +55,13 @@ export class Images extends APIResource { return this._client.post( '/images/edits', multipartFormRequestOptions( - { body, ...options, stream: body.stream ?? false, __security: { bearerAuth: true } }, + { + body, + ...options, + stream: body.stream ?? false, + __metadata: { model: body.model }, + __security: { bearerAuth: true }, + }, this._client, ), ) as APIPromise | APIPromise>; diff --git a/tests/lib/azure.test.ts b/tests/lib/azure.test.ts index 7c0192b275..537da8bd31 100644 --- a/tests/lib/azure.test.ts +++ b/tests/lib/azure.test.ts @@ -585,6 +585,18 @@ describe('azure request building', () => { }); }); + test('handles image edits', async () => { + expect( + await client.images.edit({ + model: deployment, + image: new File([], ''), + prompt: 'prompt', + }), + ).toMatchObject({ + url: `https://example.com/openai/deployments/${deployment}/images/edits?api-version=${apiVersion}`, + }); + }); + test('handles assistants', async () => { expect( await client.beta.assistants.create({