@llmgateway/ai-sdk-provider 3.6.0 → 3.7.0

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.
@@ -94,7 +94,9 @@ type LLMGatewayCompletionSettings = {
94
94
  } & LLMGatewaySharedSettings;
95
95
 
96
96
  type LLMGatewayImageModelId = string;
97
- type LLMGatewayImageSettings = {};
97
+ type LLMGatewayImageSettings = {
98
+ extraBody?: Record<string, unknown>;
99
+ };
98
100
 
99
101
  type LLMGatewayCompletionConfig = {
100
102
  provider: string;
@@ -128,6 +130,10 @@ type LLMGatewayImageConfig = {
128
130
  path: string;
129
131
  }) => string;
130
132
  fetch?: typeof fetch;
133
+ extraBody?: Record<string, unknown>;
134
+ };
135
+ type LLMGatewayImageModelCallOptions = ImageModelV3CallOptions & {
136
+ quality?: string;
131
137
  };
132
138
  declare class LLMGatewayImageModel implements ImageModelV3 {
133
139
  readonly specificationVersion: "v3";
@@ -137,7 +143,7 @@ declare class LLMGatewayImageModel implements ImageModelV3 {
137
143
  readonly settings: LLMGatewayImageSettings;
138
144
  private readonly config;
139
145
  constructor(modelId: LLMGatewayImageModelId, settings: LLMGatewayImageSettings, config: LLMGatewayImageConfig);
140
- doGenerate(options: ImageModelV3CallOptions): Promise<{
146
+ doGenerate(options: LLMGatewayImageModelCallOptions): Promise<{
141
147
  images: Array<string>;
142
148
  warnings: Array<SharedV3Warning>;
143
149
  response: {
@@ -94,7 +94,9 @@ type LLMGatewayCompletionSettings = {
94
94
  } & LLMGatewaySharedSettings;
95
95
 
96
96
  type LLMGatewayImageModelId = string;
97
- type LLMGatewayImageSettings = {};
97
+ type LLMGatewayImageSettings = {
98
+ extraBody?: Record<string, unknown>;
99
+ };
98
100
 
99
101
  type LLMGatewayCompletionConfig = {
100
102
  provider: string;
@@ -128,6 +130,10 @@ type LLMGatewayImageConfig = {
128
130
  path: string;
129
131
  }) => string;
130
132
  fetch?: typeof fetch;
133
+ extraBody?: Record<string, unknown>;
134
+ };
135
+ type LLMGatewayImageModelCallOptions = ImageModelV3CallOptions & {
136
+ quality?: string;
131
137
  };
132
138
  declare class LLMGatewayImageModel implements ImageModelV3 {
133
139
  readonly specificationVersion: "v3";
@@ -137,7 +143,7 @@ declare class LLMGatewayImageModel implements ImageModelV3 {
137
143
  readonly settings: LLMGatewayImageSettings;
138
144
  private readonly config;
139
145
  constructor(modelId: LLMGatewayImageModelId, settings: LLMGatewayImageSettings, config: LLMGatewayImageConfig);
140
- doGenerate(options: ImageModelV3CallOptions): Promise<{
146
+ doGenerate(options: LLMGatewayImageModelCallOptions): Promise<{
141
147
  images: Array<string>;
142
148
  warnings: Array<SharedV3Warning>;
143
149
  response: {
@@ -3626,13 +3626,19 @@ var LLMGatewayImageModel = class {
3626
3626
  if (options.aspectRatio != null) {
3627
3627
  body.aspect_ratio = options.aspectRatio;
3628
3628
  }
3629
+ if (options.quality != null) {
3630
+ body.quality = options.quality;
3631
+ }
3632
+ const providerOptions = options.providerOptions || {};
3633
+ const llmgatewayOptions = providerOptions.llmgateway || {};
3634
+ const requestBody = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, body), this.config.extraBody), this.settings.extraBody), llmgatewayOptions);
3629
3635
  const { value: response, responseHeaders } = await postJsonToApi({
3630
3636
  url: this.config.url({
3631
3637
  path: hasFiles ? "/images/edits" : "/images/generations",
3632
3638
  modelId: this.modelId
3633
3639
  }),
3634
3640
  headers: combineHeaders(this.config.headers(), options.headers),
3635
- body,
3641
+ body: requestBody,
3636
3642
  failedResponseHandler: llmgatewayFailedResponseHandler,
3637
3643
  successfulResponseHandler: createJsonResponseHandler(
3638
3644
  LLMGatewayImageResponseSchema