@llmgateway/ai-sdk-provider 3.4.0 → 3.5.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.
@@ -2480,10 +2480,7 @@ var LLMGatewayChatCompletionBaseResponseSchema = z6.object({
2480
2480
  reasoning_tokens: z6.number()
2481
2481
  }).nullish(),
2482
2482
  total_tokens: z6.number(),
2483
- cost: z6.union([
2484
- z6.number(),
2485
- z6.object({ total_cost: z6.number() }).passthrough()
2486
- ]).optional(),
2483
+ cost: z6.union([z6.number(), z6.object({ total_cost: z6.number() }).passthrough()]).optional(),
2487
2484
  cost_details: z6.object({
2488
2485
  upstream_inference_cost: z6.number().nullish()
2489
2486
  }).nullish()
@@ -3537,12 +3534,24 @@ var LLMGatewayImageModel = class {
3537
3534
  feature: "seed"
3538
3535
  });
3539
3536
  }
3537
+ const hasFiles = options.files != null && options.files.length > 0;
3540
3538
  const body = {
3541
3539
  model: this.modelId,
3542
3540
  prompt: options.prompt,
3543
3541
  n: options.n,
3544
3542
  response_format: "b64_json"
3545
3543
  };
3544
+ if (hasFiles) {
3545
+ body.images = options.files.map((file) => {
3546
+ var _a16;
3547
+ if (file.type === "url") {
3548
+ return { image_url: file.url };
3549
+ }
3550
+ const base64 = typeof file.data === "string" ? file.data : Buffer.from(file.data).toString("base64");
3551
+ const mediaType = (_a16 = file.mediaType) != null ? _a16 : "image/png";
3552
+ return { image_url: `data:${mediaType};base64,${base64}` };
3553
+ });
3554
+ }
3546
3555
  if (options.size != null) {
3547
3556
  body.size = options.size;
3548
3557
  }
@@ -3551,7 +3560,7 @@ var LLMGatewayImageModel = class {
3551
3560
  }
3552
3561
  const { value: response, responseHeaders } = await postJsonToApi({
3553
3562
  url: this.config.url({
3554
- path: "/images/generations",
3563
+ path: hasFiles ? "/images/edits" : "/images/generations",
3555
3564
  modelId: this.modelId
3556
3565
  }),
3557
3566
  headers: combineHeaders(this.config.headers(), options.headers),