@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.
package/dist/index.d.mts CHANGED
@@ -133,7 +133,9 @@ type LLMGatewayCompletionSettings = {
133
133
  } & LLMGatewaySharedSettings;
134
134
 
135
135
  type LLMGatewayImageModelId = string;
136
- type LLMGatewayImageSettings = {};
136
+ type LLMGatewayImageSettings = {
137
+ extraBody?: Record<string, unknown>;
138
+ };
137
139
 
138
140
  type LLMGatewayChatConfig = {
139
141
  provider: string;
@@ -191,6 +193,10 @@ type LLMGatewayImageConfig = {
191
193
  path: string;
192
194
  }) => string;
193
195
  fetch?: typeof fetch;
196
+ extraBody?: Record<string, unknown>;
197
+ };
198
+ type LLMGatewayImageModelCallOptions = ImageModelV3CallOptions & {
199
+ quality?: string;
194
200
  };
195
201
  declare class LLMGatewayImageModel implements ImageModelV3 {
196
202
  readonly specificationVersion: "v3";
@@ -200,7 +206,7 @@ declare class LLMGatewayImageModel implements ImageModelV3 {
200
206
  readonly settings: LLMGatewayImageSettings;
201
207
  private readonly config;
202
208
  constructor(modelId: LLMGatewayImageModelId, settings: LLMGatewayImageSettings, config: LLMGatewayImageConfig);
203
- doGenerate(options: ImageModelV3CallOptions): Promise<{
209
+ doGenerate(options: LLMGatewayImageModelCallOptions): Promise<{
204
210
  images: Array<string>;
205
211
  warnings: Array<SharedV3Warning>;
206
212
  response: {
package/dist/index.d.ts CHANGED
@@ -133,7 +133,9 @@ type LLMGatewayCompletionSettings = {
133
133
  } & LLMGatewaySharedSettings;
134
134
 
135
135
  type LLMGatewayImageModelId = string;
136
- type LLMGatewayImageSettings = {};
136
+ type LLMGatewayImageSettings = {
137
+ extraBody?: Record<string, unknown>;
138
+ };
137
139
 
138
140
  type LLMGatewayChatConfig = {
139
141
  provider: string;
@@ -191,6 +193,10 @@ type LLMGatewayImageConfig = {
191
193
  path: string;
192
194
  }) => string;
193
195
  fetch?: typeof fetch;
196
+ extraBody?: Record<string, unknown>;
197
+ };
198
+ type LLMGatewayImageModelCallOptions = ImageModelV3CallOptions & {
199
+ quality?: string;
194
200
  };
195
201
  declare class LLMGatewayImageModel implements ImageModelV3 {
196
202
  readonly specificationVersion: "v3";
@@ -200,7 +206,7 @@ declare class LLMGatewayImageModel implements ImageModelV3 {
200
206
  readonly settings: LLMGatewayImageSettings;
201
207
  private readonly config;
202
208
  constructor(modelId: LLMGatewayImageModelId, settings: LLMGatewayImageSettings, config: LLMGatewayImageConfig);
203
- doGenerate(options: ImageModelV3CallOptions): Promise<{
209
+ doGenerate(options: LLMGatewayImageModelCallOptions): Promise<{
204
210
  images: Array<string>;
205
211
  warnings: Array<SharedV3Warning>;
206
212
  response: {
package/dist/index.js CHANGED
@@ -3700,13 +3700,19 @@ var LLMGatewayImageModel = class {
3700
3700
  if (options.aspectRatio != null) {
3701
3701
  body.aspect_ratio = options.aspectRatio;
3702
3702
  }
3703
+ if (options.quality != null) {
3704
+ body.quality = options.quality;
3705
+ }
3706
+ const providerOptions = options.providerOptions || {};
3707
+ const llmgatewayOptions = providerOptions.llmgateway || {};
3708
+ const requestBody = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, body), this.config.extraBody), this.settings.extraBody), llmgatewayOptions);
3703
3709
  const { value: response, responseHeaders } = await postJsonToApi({
3704
3710
  url: this.config.url({
3705
3711
  path: hasFiles ? "/images/edits" : "/images/generations",
3706
3712
  modelId: this.modelId
3707
3713
  }),
3708
3714
  headers: combineHeaders(this.config.headers(), options.headers),
3709
- body,
3715
+ body: requestBody,
3710
3716
  failedResponseHandler: llmgatewayFailedResponseHandler,
3711
3717
  successfulResponseHandler: createJsonResponseHandler(
3712
3718
  LLMGatewayImageResponseSchema
@@ -3765,7 +3771,8 @@ function createLLMGateway(options = {}) {
3765
3771
  provider: "llmgateway.image",
3766
3772
  url: ({ path }) => `${baseURL}${path}`,
3767
3773
  headers: getHeaders,
3768
- fetch: options.fetch
3774
+ fetch: options.fetch,
3775
+ extraBody: options.extraBody
3769
3776
  });
3770
3777
  const createLanguageModel = (modelId, settings) => {
3771
3778
  if (new.target) {