@cartanova/qgrid-cli 2.15.3 → 2.15.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/bundle/dist/application/qgrid/qgrid.frame.js +168 -12
  2. package/bundle/dist/application/qgrid/qgrid.types.js +6 -3
  3. package/bundle/dist/application/request-log/request-log.model.js +4 -3
  4. package/bundle/dist/application/sonamu.generated.js +20 -5
  5. package/bundle/dist/application/sonamu.generated.sso.js +5 -3
  6. package/bundle/dist/i18n/en.js +2 -1
  7. package/bundle/dist/i18n/ko.js +2 -1
  8. package/bundle/dist/i18n/sd.generated.js +6 -1
  9. package/bundle/dist/migrations/20261109110340_alter_request_logs_add1_alter1.js +15 -0
  10. package/bundle/dist/utils/providers/grok/grok-types.js +1 -1
  11. package/bundle/dist/utils/providers/grok/grok-voice-client.js +4 -2
  12. package/bundle/dist/utils/providers/openai/openai-backend-protocol.js +6 -54
  13. package/bundle/dist/utils/providers/openai/openai-direct-client.js +2 -2
  14. package/bundle/dist/utils/providers/openai/openai-dispatcher.js +47 -19
  15. package/bundle/dist/utils/providers/openai/openai-image-generation.js +1 -2
  16. package/bundle/dist/utils/providers/openai/openai-realtime-protocol.js +389 -0
  17. package/bundle/dist/utils/providers/openai/openai-voice-client.js +460 -0
  18. package/bundle/src/application/qgrid/qgrid.frame.test.ts +43 -6
  19. package/bundle/src/application/qgrid/qgrid.frame.ts +246 -14
  20. package/bundle/src/application/qgrid/qgrid.types.ts +14 -2
  21. package/bundle/src/application/request-log/request-log.entity.json +17 -2
  22. package/bundle/src/application/request-log/request-log.model.test.ts +17 -0
  23. package/bundle/src/application/request-log/request-log.model.ts +11 -3
  24. package/bundle/src/application/sonamu.generated.http +2 -0
  25. package/bundle/src/application/sonamu.generated.sso.ts +2 -0
  26. package/bundle/src/application/sonamu.generated.ts +14 -0
  27. package/bundle/src/i18n/en.ts +1 -0
  28. package/bundle/src/i18n/ko.ts +1 -0
  29. package/bundle/src/i18n/sd.generated.ts +6 -0
  30. package/bundle/src/migrations/20261109110340_alter_request_logs_add1_alter1.ts +15 -0
  31. package/bundle/src/utils/providers/grok/grok-types.ts +2 -0
  32. package/bundle/src/utils/providers/grok/grok-voice-client.test.ts +2 -0
  33. package/bundle/src/utils/providers/grok/grok-voice-client.ts +2 -0
  34. package/bundle/src/utils/providers/openai/openai-backend-protocol.test.ts +8 -69
  35. package/bundle/src/utils/providers/openai/openai-backend-protocol.ts +7 -86
  36. package/bundle/src/utils/providers/openai/openai-direct-client.test.ts +0 -15
  37. package/bundle/src/utils/providers/openai/openai-direct-client.ts +3 -1
  38. package/bundle/src/utils/providers/openai/openai-dispatcher.test.ts +19 -93
  39. package/bundle/src/utils/providers/openai/openai-dispatcher.ts +98 -47
  40. package/bundle/src/utils/providers/openai/openai-image-generation.test.ts +6 -4
  41. package/bundle/src/utils/providers/openai/openai-image-generation.ts +0 -6
  42. package/bundle/src/utils/providers/openai/openai-realtime-protocol.ts +550 -0
  43. package/bundle/src/utils/providers/openai/openai-voice-client.test.ts +582 -0
  44. package/bundle/src/utils/providers/openai/openai-voice-client.ts +744 -0
  45. package/bundle/web-dist/client/assets/index-DyrPRt6O.css +1 -0
  46. package/bundle/web-dist/client/assets/index-Wi8Wxte6.js +104 -0
  47. package/bundle/web-dist/client/assets/{logs-Dw-GrMuH.js → logs-Bdg3wJV2.js} +1 -1
  48. package/bundle/web-dist/client/assets/{monit-BaFFiVKs.js → monit-DcwHRAKu.js} +1 -1
  49. package/bundle/web-dist/client/assets/{routes-R1xBZYVT.js → routes-lxVC1DDJ.js} +1 -1
  50. package/bundle/web-dist/client/assets/{settings-Bw_NXAx8.js → settings-C0VCdd1C.js} +1 -1
  51. package/bundle/web-dist/client/assets/{show-BH7nfFtF.js → show-B7QRPxsY.js} +2 -2
  52. package/bundle/web-dist/client/assets/{tokens-BPmRr7mD.js → tokens-CNRSm9sc.js} +1 -1
  53. package/bundle/web-dist/client/assets/{use-oauth-login-flow-B_MGbC3a.js → use-oauth-login-flow-eQnMzp8A.js} +1 -1
  54. package/bundle/web-dist/client/assets/{use-update-token-mutation-Dcq7Yv2R.js → use-update-token-mutation-KnwyYQjb.js} +1 -1
  55. package/bundle/web-dist/client/assets/voice-BydIuS0A.js +1 -0
  56. package/bundle/web-dist/client/index.html +2 -2
  57. package/bundle/web-dist/client/voice-samples/grok/altair.mp3 +0 -0
  58. package/bundle/web-dist/client/voice-samples/grok/ara.mp3 +0 -0
  59. package/bundle/web-dist/client/voice-samples/grok/atlas.mp3 +0 -0
  60. package/bundle/web-dist/client/voice-samples/grok/aurora.mp3 +0 -0
  61. package/bundle/web-dist/client/voice-samples/grok/carina.mp3 +0 -0
  62. package/bundle/web-dist/client/voice-samples/grok/castor.mp3 +0 -0
  63. package/bundle/web-dist/client/voice-samples/grok/celeste.mp3 +0 -0
  64. package/bundle/web-dist/client/voice-samples/grok/cosmo.mp3 +0 -0
  65. package/bundle/web-dist/client/voice-samples/grok/eve.mp3 +0 -0
  66. package/bundle/web-dist/client/voice-samples/grok/helios.mp3 +0 -0
  67. package/bundle/web-dist/client/voice-samples/grok/helix.mp3 +0 -0
  68. package/bundle/web-dist/client/voice-samples/grok/iris.mp3 +0 -0
  69. package/bundle/web-dist/client/voice-samples/grok/kepler.mp3 +0 -0
  70. package/bundle/web-dist/client/voice-samples/grok/leo.mp3 +0 -0
  71. package/bundle/web-dist/client/voice-samples/grok/liora.mp3 +0 -0
  72. package/bundle/web-dist/client/voice-samples/grok/lumen.mp3 +0 -0
  73. package/bundle/web-dist/client/voice-samples/grok/luna.mp3 +0 -0
  74. package/bundle/web-dist/client/voice-samples/grok/lux.mp3 +0 -0
  75. package/bundle/web-dist/client/voice-samples/grok/naksh.mp3 +0 -0
  76. package/bundle/web-dist/client/voice-samples/grok/orion.mp3 +0 -0
  77. package/bundle/web-dist/client/voice-samples/grok/perseus.mp3 +0 -0
  78. package/bundle/web-dist/client/voice-samples/grok/rex.mp3 +0 -0
  79. package/bundle/web-dist/client/voice-samples/grok/rigel.mp3 +0 -0
  80. package/bundle/web-dist/client/voice-samples/grok/sal.mp3 +0 -0
  81. package/bundle/web-dist/client/voice-samples/grok/sirius.mp3 +0 -0
  82. package/bundle/web-dist/client/voice-samples/grok/ursa.mp3 +0 -0
  83. package/bundle/web-dist/client/voice-samples/grok/zagan.mp3 +0 -0
  84. package/bundle/web-dist/client/voice-samples/grok/zenith.mp3 +0 -0
  85. package/bundle/web-dist/client/voice-samples/openai/alloy.mp3 +0 -0
  86. package/bundle/web-dist/client/voice-samples/openai/ash.mp3 +0 -0
  87. package/bundle/web-dist/client/voice-samples/openai/ballad.mp3 +0 -0
  88. package/bundle/web-dist/client/voice-samples/openai/cedar.mp3 +0 -0
  89. package/bundle/web-dist/client/voice-samples/openai/coral.mp3 +0 -0
  90. package/bundle/web-dist/client/voice-samples/openai/echo.mp3 +0 -0
  91. package/bundle/web-dist/client/voice-samples/openai/marin.mp3 +0 -0
  92. package/bundle/web-dist/client/voice-samples/openai/sage.mp3 +0 -0
  93. package/bundle/web-dist/client/voice-samples/openai/shimmer.mp3 +0 -0
  94. package/bundle/web-dist/client/voice-samples/openai/verse.mp3 +0 -0
  95. package/bundle/web-dist/server/assets/link-DrdV092C.js +4919 -0
  96. package/bundle/web-dist/server/assets/{logs-6289J29J.js → logs-BmBpBe-j.js} +13 -6
  97. package/bundle/web-dist/server/assets/{monit-YVvwJuAF.js → monit-Db1WrIls.js} +2 -2
  98. package/bundle/web-dist/server/assets/{plus-z5Hy__3C.js → plus-CW9y_K7l.js} +1 -1
  99. package/bundle/web-dist/server/assets/{refresh-cw-CNm0CERy.js → refresh-cw-CRgcH5bT.js} +1 -1
  100. package/bundle/web-dist/server/assets/{request-model-DIuPZZwu.js → request-model-DRF7hmJC.js} +1 -1
  101. package/bundle/web-dist/server/assets/{routes-DVWRvqn0.js → routes-CARZj7or.js} +4 -4
  102. package/bundle/web-dist/server/assets/{services.generated-CqS8DCjT.js → services.generated-B6QpnL_N.js} +7 -0
  103. package/bundle/web-dist/server/assets/{settings-CXwnKiMG.js → settings-B4jdpP5N.js} +4 -4
  104. package/bundle/web-dist/server/assets/{show-G1t8dOEh.js → show-D8r2sVK0.js} +17 -9
  105. package/bundle/web-dist/server/assets/{tokens-Di1vDwm5.js → tokens-TDQguTdh.js} +5 -5
  106. package/bundle/web-dist/server/assets/{use-oauth-login-flow-BUAcW_pK.js → use-oauth-login-flow-du7pOh_H.js} +1 -1
  107. package/bundle/web-dist/server/assets/{use-update-token-mutation-oH0O0n-g.js → use-update-token-mutation-DA6HiiWS.js} +1 -1
  108. package/bundle/web-dist/server/assets/voice-C2HfwkGp.js +668 -0
  109. package/bundle/web-dist/server/entry-server.generated.js +125 -4989
  110. package/bundle/web-dist/server/voice-samples/grok/altair.mp3 +0 -0
  111. package/bundle/web-dist/server/voice-samples/grok/ara.mp3 +0 -0
  112. package/bundle/web-dist/server/voice-samples/grok/atlas.mp3 +0 -0
  113. package/bundle/web-dist/server/voice-samples/grok/aurora.mp3 +0 -0
  114. package/bundle/web-dist/server/voice-samples/grok/carina.mp3 +0 -0
  115. package/bundle/web-dist/server/voice-samples/grok/castor.mp3 +0 -0
  116. package/bundle/web-dist/server/voice-samples/grok/celeste.mp3 +0 -0
  117. package/bundle/web-dist/server/voice-samples/grok/cosmo.mp3 +0 -0
  118. package/bundle/web-dist/server/voice-samples/grok/eve.mp3 +0 -0
  119. package/bundle/web-dist/server/voice-samples/grok/helios.mp3 +0 -0
  120. package/bundle/web-dist/server/voice-samples/grok/helix.mp3 +0 -0
  121. package/bundle/web-dist/server/voice-samples/grok/iris.mp3 +0 -0
  122. package/bundle/web-dist/server/voice-samples/grok/kepler.mp3 +0 -0
  123. package/bundle/web-dist/server/voice-samples/grok/leo.mp3 +0 -0
  124. package/bundle/web-dist/server/voice-samples/grok/liora.mp3 +0 -0
  125. package/bundle/web-dist/server/voice-samples/grok/lumen.mp3 +0 -0
  126. package/bundle/web-dist/server/voice-samples/grok/luna.mp3 +0 -0
  127. package/bundle/web-dist/server/voice-samples/grok/lux.mp3 +0 -0
  128. package/bundle/web-dist/server/voice-samples/grok/naksh.mp3 +0 -0
  129. package/bundle/web-dist/server/voice-samples/grok/orion.mp3 +0 -0
  130. package/bundle/web-dist/server/voice-samples/grok/perseus.mp3 +0 -0
  131. package/bundle/web-dist/server/voice-samples/grok/rex.mp3 +0 -0
  132. package/bundle/web-dist/server/voice-samples/grok/rigel.mp3 +0 -0
  133. package/bundle/web-dist/server/voice-samples/grok/sal.mp3 +0 -0
  134. package/bundle/web-dist/server/voice-samples/grok/sirius.mp3 +0 -0
  135. package/bundle/web-dist/server/voice-samples/grok/ursa.mp3 +0 -0
  136. package/bundle/web-dist/server/voice-samples/grok/zagan.mp3 +0 -0
  137. package/bundle/web-dist/server/voice-samples/grok/zenith.mp3 +0 -0
  138. package/bundle/web-dist/server/voice-samples/openai/alloy.mp3 +0 -0
  139. package/bundle/web-dist/server/voice-samples/openai/ash.mp3 +0 -0
  140. package/bundle/web-dist/server/voice-samples/openai/ballad.mp3 +0 -0
  141. package/bundle/web-dist/server/voice-samples/openai/cedar.mp3 +0 -0
  142. package/bundle/web-dist/server/voice-samples/openai/coral.mp3 +0 -0
  143. package/bundle/web-dist/server/voice-samples/openai/echo.mp3 +0 -0
  144. package/bundle/web-dist/server/voice-samples/openai/marin.mp3 +0 -0
  145. package/bundle/web-dist/server/voice-samples/openai/sage.mp3 +0 -0
  146. package/bundle/web-dist/server/voice-samples/openai/shimmer.mp3 +0 -0
  147. package/bundle/web-dist/server/voice-samples/openai/verse.mp3 +0 -0
  148. package/package.json +1 -1
  149. package/skills/qgrid/SKILL.md +5 -5
  150. package/skills/qgrid/references/ai-sdk-provider-contract.md +4 -0
  151. package/skills/qgrid/references/decision-rationale.md +13 -3
  152. package/skills/qgrid/references/openai-codex-runtime.md +17 -5
  153. package/skills/qgrid/references/request-log-run-lifecycle.md +7 -2
  154. package/skills/qgrid/references/sonamu-api-web-flow.md +6 -2
  155. package/skills/qgrid/references/verification-and-debugging.md +3 -3
  156. package/bundle/web-dist/client/assets/index-BakMhnHZ.js +0 -104
  157. package/bundle/web-dist/client/assets/index-DLo1QCw7.css +0 -1
@@ -1,10 +1,7 @@
1
1
  import { getLogger } from "@logtape/logtape";
2
2
  import { z } from "zod";
3
3
 
4
- import {
5
- type ImageGenerationMetadata,
6
- QuotaThresholdExceededError,
7
- } from "../../../application/qgrid/qgrid.types";
4
+ import { QuotaThresholdExceededError } from "../../../application/qgrid/qgrid.types";
8
5
  import { TokenModel } from "../../../application/token/token.model";
9
6
  import { type OpenAICredentials } from "../../../application/token/token.types";
10
7
  import { isOpenAICredentials } from "../common/credentials";
@@ -26,10 +23,22 @@ import {
26
23
  type OpenAIResponseItem,
27
24
  type OpenAIResponsesOptions,
28
25
  } from "./openai-backend-protocol";
29
- import { OpenAIDirectClient, type OpenAIDirectClientOptions } from "./openai-direct-client";
26
+ import {
27
+ OpenAIDirectClient,
28
+ type OpenAIDirectClientOptions,
29
+ type OpenAIDirectCredentials,
30
+ } from "./openai-direct-client";
30
31
  import { readOpenAIQuotaUsage, type OpenAIRateLimitsWithMeta } from "./openai-quota";
31
32
  import { handleChatgptAuthTokensRefresh } from "./openai-refresh";
32
33
  import { type OpenAITransportKind, resolveOpenAITransportKind } from "./openai-transport-config";
34
+ import {
35
+ isUnauthorizedRealtimeError,
36
+ type OpenAISpeakRequest,
37
+ type OpenAISpeechResult,
38
+ type OpenAITranscribeRequest,
39
+ type OpenAITranscription,
40
+ OpenAIVoiceClient,
41
+ } from "./openai-voice-client";
33
42
 
34
43
  const logger = getLogger(["qgrid", "openai-dispatcher"]);
35
44
 
@@ -115,6 +124,19 @@ type ClientEntry = {
115
124
  export interface OpenAIDispatcherDependencies {
116
125
  clientFactory?: OpenAIDirectClientFactory;
117
126
  fetch?: typeof fetch;
127
+ voiceClient?: OpenAIVoiceClient;
128
+ }
129
+
130
+ /** Realtime voice call with the media-endpoint token selection contract. */
131
+ export type OpenAIVoiceSelection = {
132
+ preferredTokenId?: number;
133
+ requirePreferredToken?: boolean;
134
+ };
135
+
136
+ export interface OpenAIVoiceDispatchResult<T> {
137
+ result: T;
138
+ tokenId: number;
139
+ tokenName: string;
118
140
  }
119
141
 
120
142
  function abortError(signal: AbortSignal): Error {
@@ -293,6 +315,7 @@ export class OpenAIDispatcher implements ProviderDispatcher {
293
315
  readonly selector = new SmoothWeightedRoundRobin();
294
316
  readonly clientFactory: OpenAIDirectClientFactory;
295
317
  readonly fetchImpl: typeof fetch;
318
+ readonly voiceClient: OpenAIVoiceClient;
296
319
  readonly quotaBlocked = new Set<number>();
297
320
  inFlight = 0;
298
321
 
@@ -304,6 +327,75 @@ export class OpenAIDispatcher implements ProviderDispatcher {
304
327
  this.clientFactory =
305
328
  dependencies.clientFactory ?? ((options) => new OpenAIDirectClient(options));
306
329
  this.fetchImpl = dependencies.fetch ?? fetch;
330
+ this.voiceClient = dependencies.voiceClient ?? new OpenAIVoiceClient({ fetch: this.fetchImpl });
331
+ }
332
+
333
+ // ---- Realtime voice (speech-to-text, text-to-speech) ----------------------
334
+
335
+ async transcribe(
336
+ request: OpenAITranscribeRequest & OpenAIVoiceSelection,
337
+ ): Promise<OpenAIVoiceDispatchResult<OpenAITranscription>> {
338
+ const { preferredTokenId, requirePreferredToken, ...voiceRequest } = request;
339
+
340
+ return this.runVoice(
341
+ { preferredTokenId, requirePreferredToken },
342
+ request.signal,
343
+ (credentials) => this.voiceClient.transcribe(credentials, voiceRequest),
344
+ );
345
+ }
346
+
347
+ async speak(
348
+ request: OpenAISpeakRequest & OpenAIVoiceSelection,
349
+ ): Promise<OpenAIVoiceDispatchResult<OpenAISpeechResult>> {
350
+ const { preferredTokenId, requirePreferredToken, ...voiceRequest } = request;
351
+
352
+ return this.runVoice(
353
+ { preferredTokenId, requirePreferredToken },
354
+ request.signal,
355
+ (credentials) => this.voiceClient.speak(credentials, voiceRequest),
356
+ );
357
+ }
358
+
359
+ /**
360
+ * Selects a token, runs the realtime call, and on one 401 refreshes that token's credentials and
361
+ * retries once (as the Responses transports do). Any other failure propagates: a realtime
362
+ * session that failed may already have consumed audio tokens.
363
+ */
364
+ async runVoice<T>(
365
+ selection: OpenAIVoiceSelection,
366
+ signal: AbortSignal | undefined,
367
+ call: (credentials: OpenAIDirectCredentials) => Promise<T>,
368
+ ): Promise<OpenAIVoiceDispatchResult<T>> {
369
+ const active = signal ?? new AbortController().signal;
370
+
371
+ const selected = await this.selectToken(
372
+ selection.preferredTokenId,
373
+ selection.requirePreferredToken ?? false,
374
+ active,
375
+ );
376
+
377
+ const { tokenId, metadata } = selected;
378
+
379
+ let credentials: OpenAIDirectCredentials = {
380
+ accessToken: metadata.credentials.accessToken,
381
+ accountId: metadata.credentials.accountId,
382
+ };
383
+
384
+ for (let attempt = 0; ; attempt++) {
385
+ try {
386
+ const result = await call(credentials);
387
+ this.invalidateRateLimitsCache(tokenId);
388
+
389
+ return { result, tokenId, tokenName: metadata.name };
390
+ } catch (error) {
391
+ if (attempt === 0 && error instanceof Error && isUnauthorizedRealtimeError(error)) {
392
+ credentials = await this.refreshCredentials(tokenId);
393
+ continue;
394
+ }
395
+
396
+ throw error;
397
+ }
398
+ }
307
399
  }
308
400
 
309
401
  async start(): Promise<void> {
@@ -578,14 +670,9 @@ export class OpenAIDispatcher implements ProviderDispatcher {
578
670
  streamedMessageIds.add(itemId);
579
671
  }
580
672
  } else if (event.type === "image") {
581
- if (auto)
582
- throw new ImageGenerationError("incomplete", "Unexpected hosted image generation");
673
+ if (auto) throw new ImageGenerationError("incomplete", "Unexpected image output");
583
674
  imageAttempted = true;
584
675
  images.push(generatedImageFrom(event));
585
- } else if (event.type === "output-item" && event.item.type === "image_generation_call") {
586
- if (auto)
587
- throw new ImageGenerationError("incomplete", "Unexpected hosted image generation");
588
- imageAttempted = true;
589
676
  } else if (auto && event.type === "output-item" && event.item.type === "function_call") {
590
677
  if (event.item.name !== IMAGE_TOOL) {
591
678
  throw new ImageGenerationError("incomplete", "Unexpected automatic image tool call");
@@ -632,17 +719,6 @@ export class OpenAIDispatcher implements ProviderDispatcher {
632
719
  num_last_images_to_include: args.num_last_images_to_include,
633
720
  });
634
721
  } else if (event.type === "completed") {
635
- const imageUsage = event.imageGeneration?.usage;
636
-
637
- // The backend also reports all-zero image usage for text-only responses.
638
- if (
639
- auto &&
640
- imageUsage &&
641
- (imageUsage.input_tokens > 0 ||
642
- imageUsage.output_tokens > 0 ||
643
- imageUsage.total_tokens > 0)
644
- )
645
- throw new ImageGenerationError("incomplete", "Unexpected hosted image generation");
646
722
  driverCompleted = true;
647
723
  servingModel = event.model ?? servingModel;
648
724
 
@@ -655,31 +731,6 @@ export class OpenAIDispatcher implements ProviderDispatcher {
655
731
  reasoningOutputTokens: event.usage.reasoningTokens,
656
732
  };
657
733
  }
658
-
659
- if (event.imageGeneration) {
660
- const hostedImages = images.filter(
661
- (image) => image.generation?.route === "codex-responses",
662
- );
663
-
664
- for (const [index, image] of hostedImages.entries()) {
665
- const generation: ImageGenerationMetadata = {
666
- route: "codex-responses",
667
- ...image.generation,
668
- };
669
-
670
- // The image's own model wins; the response-level model only fills a gap.
671
- if (generation.model === undefined && event.imageGeneration.model) {
672
- generation.model = event.imageGeneration.model;
673
- }
674
-
675
- // Tool usage covers the whole response, not each returned image.
676
- if (index === 0 && event.imageGeneration.usage) {
677
- generation.usage = event.imageGeneration.usage;
678
- }
679
-
680
- image.generation = generation;
681
- }
682
- }
683
734
  } else if (event.type === "error") {
684
735
  if (req.imageGeneration)
685
736
  throw new ImageGenerationError("incomplete", event.error.message);
@@ -152,9 +152,11 @@ describe("standalone transparent images", () => {
152
152
  });
153
153
 
154
154
  describe("standalone image model", () => {
155
- it.each([true, { background: "opaque" }, { background: "auto" }])(
156
- "generates ordinary PNGs directly without the Responses transport (%j)",
157
- async (imageGeneration) => {
155
+ // Chat models use the same route: hosted Responses images reject driver reasoning effort.
156
+ it.each(["gpt-image-2", "gpt-6-luna"].flatMap((model) =>
157
+ [true, { background: "opaque" }, { background: "auto" }].map((imageGeneration) => [model, imageGeneration] as const)))(
158
+ "generates ordinary PNGs for %s directly without the Responses transport (%j)",
159
+ async (model, imageGeneration) => {
158
160
  const stream = vi.fn();
159
161
  const fetchMock = vi.fn<typeof fetch>(async () => Response.json({
160
162
  data: [{ b64_json: png([255, 255]) }],
@@ -165,7 +167,7 @@ describe("standalone image model", () => {
165
167
  transport: { stream },
166
168
  });
167
169
  const events = await Array.fromAsync(client.responses({
168
- ...options, model: "gpt-image-2", imageGeneration,
170
+ ...options, model, imageGeneration, reasoning: { effort: "high" },
169
171
  }));
170
172
  expect(stream).not.toHaveBeenCalled();
171
173
  expect(fetchMock).toHaveBeenCalledTimes(1);
@@ -44,12 +44,6 @@ export function buildStandaloneImageRequest(options: OpenAIResponsesOptions) {
44
44
 
45
45
  const controls = options.imageGeneration === true ? {} : options.imageGeneration;
46
46
 
47
- if (options.model !== "gpt-image-2" && controls.background !== "transparent") {
48
- throw new OpenAIProtocolError(
49
- "Standalone images require an explicit transparent background request",
50
- );
51
- }
52
-
53
47
  if (controls.output_format && controls.output_format !== "png") {
54
48
  throw new OpenAIProtocolError("Standalone image generation only supports PNG output");
55
49
  }