@picsart/ai-sdk 6.36.0 → 6.38.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/README.md CHANGED
@@ -194,7 +194,7 @@ names or catalog model IDs from an arbitrary vendor request.
194
194
 
195
195
  ## Text Generation (LLMs)
196
196
 
197
- Claude, GPT, and Gemini text models are called with `generateText()`. Single-shot:
197
+ Claude, GPT, Gemini, Kimi and Grok text models are called with `generateText()`. Single-shot:
198
198
  pass a prompt and optional image(s)/video, get text back. They surface in the catalog
199
199
  as `mode: 'text'`. Each vendor uses its own native workflow, so capabilities aren't lost
200
200
  — Gemini accepts video input, Claude uses the Anthropic-native messages API.
@@ -227,8 +227,9 @@ await ai.generateText(Models.Gemini3Pro, {
227
227
  catalog.find({ output: 'text' })
228
228
  ```
229
229
 
230
- > Thinking level maps per vendor: OpenAI → `reasoning_effort`, Gemini →
231
- > `thinkingConfig.thinkingLevel` (LOW/HIGH). Claude’s `claude/v1/messages`
230
+ > Thinking level maps per vendor: OpenAI, Kimi and Grok → `reasoning_effort`, Gemini →
231
+ > `thinkingConfig.thinkingLevel` (LOW/HIGH). Kimi K3 and Grok 4.7 always reason, so
232
+ > they have no `off`. Claude’s `claude/v1/messages`
232
233
  > workflow exposes no thinking knob, so Claude models omit `thinking`.
233
234
 
234
235
  `generateText()` is type-narrowed to text models (`TextModelId`); calling it with an
package/index.d.ts CHANGED
@@ -659,6 +659,11 @@ type ModelInputById = {
659
659
  count?: 1 | 2 | 4 | 6 | 8 | 10;
660
660
  imageUrls?: string[];
661
661
  };
662
+ "grok-4.7": {
663
+ prompt: string;
664
+ imageUrls?: string[];
665
+ thinking?: "low" | "medium" | "high";
666
+ };
662
667
  "grok-edit-video": {
663
668
  prompt: string;
664
669
  videoUrl: string;
@@ -1060,7 +1065,7 @@ type ModelInputById = {
1060
1065
  negativePrompt?: string;
1061
1066
  aspectRatio?: "21:9" | "16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "9:21";
1062
1067
  resolution?: "480p" | "720p" | "1080p";
1063
- numFrames?: number;
1068
+ duration?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
1064
1069
  fps?: number;
1065
1070
  sourceScale?: number;
1066
1071
  videoStrength?: number;
@@ -2093,7 +2098,7 @@ type ModelInputById = {
2093
2098
  type TypedModelId = keyof ModelInputById;
2094
2099
  type ModelInput<M extends TypedModelId> = ModelInputById[M];
2095
2100
  /** IDs of text-generation (LLM) models — narrows generateText(). */
2096
- type TextModelId = "claude-fable-5" | "claude-fable-5-1" | "claude-haiku-4-5" | "claude-haiku-5-5" | "claude-opus-4-8" | "claude-opus-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "eleven-speech-to-text" | "gemini-2.5-flash" | "gemini-3-pro" | "gemini-3.5-flash-lite" | "gemini-3.6-flash" | "gemini-3.7-flash" | "gemini-3.8-flash" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o" | "gpt-4o-mini" | "gpt-5" | "gpt-5-mini" | "gpt-5.1" | "gpt-5.2" | "gpt-5.5" | "gpt-5.6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-6-astra" | "gpt-6-luna" | "gpt-6-sol" | "kimi-k3";
2101
+ type TextModelId = "claude-fable-5" | "claude-fable-5-1" | "claude-haiku-4-5" | "claude-haiku-5-5" | "claude-opus-4-8" | "claude-opus-5" | "claude-sonnet-4-5" | "claude-sonnet-4-6" | "claude-sonnet-5" | "eleven-speech-to-text" | "gemini-2.5-flash" | "gemini-3-pro" | "gemini-3.5-flash-lite" | "gemini-3.6-flash" | "gemini-3.7-flash" | "gemini-3.8-flash" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o" | "gpt-4o-mini" | "gpt-5" | "gpt-5-mini" | "gpt-5.1" | "gpt-5.2" | "gpt-5.5" | "gpt-5.6-luna" | "gpt-5.6-sol" | "gpt-5.6-terra" | "gpt-6-astra" | "gpt-6-luna" | "gpt-6-sol" | "grok-4.7" | "kimi-k3";
2097
2102
  type TextModelInputById = Pick<ModelInputById, TextModelId>;
2098
2103
  /** IDs of structured-output (json-mode) models — narrows run()'s result type. */
2099
2104
  type JsonModelId = "typesafe-evaluate";
@@ -3533,6 +3538,7 @@ declare const Models: {
3533
3538
  readonly GptImage2: "gpt-image-2";
3534
3539
  readonly GptImage25Flare: "gpt-image-2.5-flare";
3535
3540
  readonly GptImage25Sunburst: "gpt-image-2.5-sunburst";
3541
+ readonly Grok47: "grok-4.7";
3536
3542
  readonly GrokEditVideo: "grok-edit-video";
3537
3543
  readonly GrokExtendVideo: "grok-extend-video";
3538
3544
  readonly GrokImagineImage: "grok-imagine-image";
package/index.js CHANGED
@@ -2198,6 +2198,47 @@ var LTX_23_REFRAME_RESOLUTIONS = ["720p", "1080p"];
2198
2198
  var LTX_23_REFRAME_AR = ["16:9", "9:16", "1:1", "4:5", "5:4"];
2199
2199
  var LTX_23_OUTPAINT_RESOLUTIONS = ["480p", "720p", "1080p"];
2200
2200
  var LTX_23_OUTPAINT_AR = ["21:9", "16:9", "4:3", "1:1", "3:4", "9:16", "9:21"];
2201
+ var LTX_23_OUTPAINT_DURATIONS = [
2202
+ 1,
2203
+ 2,
2204
+ 3,
2205
+ 4,
2206
+ 5,
2207
+ 6,
2208
+ 7,
2209
+ 8,
2210
+ 9,
2211
+ 10,
2212
+ 11,
2213
+ 12,
2214
+ 13,
2215
+ 14,
2216
+ 15,
2217
+ 16,
2218
+ 17,
2219
+ 18,
2220
+ 19,
2221
+ 20
2222
+ ];
2223
+ var LTX_23_OUTPAINT_MIN_FRAMES = 9;
2224
+ var LTX_23_OUTPAINT_MAX_FRAMES = 481;
2225
+ var LTX_23_OUTPAINT_FPS_MAX = 60;
2226
+ var ltxOutpaintDurationConstraints = [];
2227
+ for (let fps = 1; fps <= LTX_23_OUTPAINT_FPS_MAX; fps++) {
2228
+ const allowed = LTX_23_OUTPAINT_DURATIONS.filter(
2229
+ (d) => d * fps >= LTX_23_OUTPAINT_MIN_FRAMES && d * fps <= LTX_23_OUTPAINT_MAX_FRAMES
2230
+ );
2231
+ if (allowed.length === LTX_23_OUTPAINT_DURATIONS.length) continue;
2232
+ ltxOutpaintDurationConstraints.push({
2233
+ when: { fps: { is: fps } },
2234
+ then: {
2235
+ duration: {
2236
+ allowed,
2237
+ reason: `At ${fps} fps the clip must run ${allowed[0]}\u2013${allowed[allowed.length - 1]}s (the ${LTX_23_OUTPAINT_MIN_FRAMES}\u2013${LTX_23_OUTPAINT_MAX_FRAMES}-frame window).`
2238
+ }
2239
+ }
2240
+ });
2241
+ }
2201
2242
  var LTX_25_AR = ["16:9", "9:16"];
2202
2243
  var LTX_25_PRO_RESOLUTIONS = ["720p", "1080p"];
2203
2244
  var LTX_25_FAST_RESOLUTIONS = ["720p", "1080p", "1440p", "2160p"];
@@ -2543,8 +2584,11 @@ var { MODELS: MODELS2 } = defineModels("ltx", [
2543
2584
  ...params.negativePrompt(),
2544
2585
  ...params.aspectRatio(LTX_23_OUTPAINT_AR),
2545
2586
  ...params.resolution(LTX_23_OUTPAINT_RESOLUTIONS, "720p"),
2546
- ...p.range("numFrames", 9, 481, 121, { label: "Frames" }),
2547
- ...p.range("fps", 1, 60, 24, { label: "FPS" }),
2587
+ // Duration is an enum; fps stays a slider. The per-fps constraint below
2588
+ // trims the duration options, and the builder derives the wire's num_frames
2589
+ // (clamped) from duration × fps.
2590
+ ...params.duration(LTX_23_OUTPAINT_DURATIONS, 6),
2591
+ ...p.range("fps", 1, 60, 24, { step: 1, label: "FPS" }),
2548
2592
  // 1.0 fits the source as large as the canvas allows; lower values zoom it
2549
2593
  // out and leave a wider generated border, which the vendor calls less stable.
2550
2594
  ...p.range("sourceScale", 0.25, 1, 1, { step: 0.05, label: "Source Scale" }),
@@ -2559,7 +2603,10 @@ var { MODELS: MODELS2 } = defineModels("ltx", [
2559
2603
  ...p.boolean("enableSafetyChecker", true, "Safety Checker"),
2560
2604
  // Default-less on purpose: unset means the vendor picks a random seed.
2561
2605
  ...params.seed()
2562
- }
2606
+ },
2607
+ // Raising fps packs more frames per second, so it shortens the longest clip
2608
+ // that fits the vendor's 481-frame ceiling — hence the duration options trim.
2609
+ constraints: ltxOutpaintDurationConstraints
2563
2610
  },
2564
2611
  // ── LTX 2.5 ──────────────────────────────────────────────────────
2565
2612
  // One entry per tier: text-to-video on `workflow`, image-to-video on
@@ -10579,7 +10626,27 @@ var { MODELS: KIMI_LLM } = defineModels("kimi", [
10579
10626
  }
10580
10627
  }
10581
10628
  ]);
10582
- var MODELS35 = [...ANTHROPIC, ...OPENAI_LLM, ...GEMINI_LLM, ...KIMI_LLM];
10629
+ var grokThinkingParam = () => p.enum("thinking", ["low", "medium", "high"], "high", { label: "Thinking" });
10630
+ var { MODELS: GROK_LLM } = defineModels("grok", [
10631
+ {
10632
+ id: "grok-4.7",
10633
+ name: "Grok 4.7",
10634
+ workflow: "chat-completions",
10635
+ addedAt: "2026-10-14",
10636
+ estimatedTime: 10,
10637
+ mode: "text",
10638
+ inputType: "i2t",
10639
+ badge: ["new"],
10640
+ description: "xAI\u2019s flagship Grok model \u2014 always-on reasoning with a 500K-token context.",
10641
+ features: [feat("Vision", "input"), feat("Thinking", "characteristic")],
10642
+ paramConfig: {
10643
+ ...params.prompt(),
10644
+ ...params.imageInput(8, "Images"),
10645
+ ...grokThinkingParam()
10646
+ }
10647
+ }
10648
+ ]);
10649
+ var MODELS35 = [...ANTHROPIC, ...OPENAI_LLM, ...GEMINI_LLM, ...KIMI_LLM, ...GROK_LLM];
10583
10650
 
10584
10651
  // src/vendors/catalog/llm.payloads.ts
10585
10652
  var CLAUDE_MAX_TOKENS = 8192;
@@ -10663,7 +10730,8 @@ registerPayloads(MODELS35, {
10663
10730
  "gemini-3.6-flash": buildOpenAiPayload("gemini-3.6-flash"),
10664
10731
  "gemini-3.5-flash-lite": buildOpenAiPayload("gemini-3.5-flash-lite"),
10665
10732
  "gemini-2.5-flash": buildOpenAiPayload("gemini-2.5-flash"),
10666
- "kimi-k3": buildOpenAiPayload("kimi-k3")
10733
+ "kimi-k3": buildOpenAiPayload("kimi-k3"),
10734
+ "grok-4.7": buildOpenAiPayload("grok-4.7")
10667
10735
  });
10668
10736
 
10669
10737
  // src/vendors/catalog/captionsai.ts
@@ -11022,25 +11090,34 @@ var buildLtx23ReframePayload = (input) => ({
11022
11090
  ...input.resolution ? { resolution: input.resolution } : {},
11023
11091
  ...input.aspectRatio ? { aspect_ratio: input.aspectRatio } : {}
11024
11092
  });
11025
- var buildLtx23OutpaintPayload = (input) => ({
11026
- prompt: input.prompt,
11027
- video_url: input.videoUrl,
11028
- ...input.negativePrompt ? { negative_prompt: input.negativePrompt } : {},
11029
- ...input.aspectRatio ? { aspect_ratio: input.aspectRatio } : {},
11030
- ...input.resolution ? { output_resolution: input.resolution } : {},
11031
- ...input.numFrames != null ? { num_frames: input.numFrames } : {},
11032
- ...input.fps != null ? { frames_per_second: input.fps } : {},
11033
- ...input.sourceScale != null ? { source_scale: input.sourceScale } : {},
11034
- ...input.videoStrength != null ? { video_strength: input.videoStrength } : {},
11035
- ...input.cfgScale != null ? { guidance_scale: input.cfgScale } : {},
11036
- ...input.numInferenceSteps != null ? { num_inference_steps: input.numInferenceSteps } : {},
11037
- ...input.videoQuality ? { video_quality: input.videoQuality } : {},
11038
- ...input.videoWriteMode ? { video_write_mode: input.videoWriteMode } : {},
11039
- ...input.seed != null ? { seed: input.seed } : {},
11040
- enable_prompt_expansion: input.enhancePrompt ?? true,
11041
- generate_audio: input.generateAudio ?? true,
11042
- enable_safety_checker: input.enableSafetyChecker ?? true
11043
- });
11093
+ var OUTPAINT_NUM_FRAMES_MIN = 9;
11094
+ var OUTPAINT_NUM_FRAMES_MAX = 481;
11095
+ var buildLtx23OutpaintPayload = (input) => {
11096
+ const fps = input.fps ?? 24;
11097
+ const numFrames = input.duration != null ? Math.min(
11098
+ OUTPAINT_NUM_FRAMES_MAX,
11099
+ Math.max(OUTPAINT_NUM_FRAMES_MIN, Math.round(input.duration * fps))
11100
+ ) : void 0;
11101
+ return {
11102
+ prompt: input.prompt,
11103
+ video_url: input.videoUrl,
11104
+ ...input.negativePrompt ? { negative_prompt: input.negativePrompt } : {},
11105
+ ...input.aspectRatio ? { aspect_ratio: input.aspectRatio } : {},
11106
+ ...input.resolution ? { output_resolution: input.resolution } : {},
11107
+ ...numFrames != null ? { num_frames: numFrames } : {},
11108
+ ...input.fps != null ? { frames_per_second: input.fps } : {},
11109
+ ...input.sourceScale != null ? { source_scale: input.sourceScale } : {},
11110
+ ...input.videoStrength != null ? { video_strength: input.videoStrength } : {},
11111
+ ...input.cfgScale != null ? { guidance_scale: input.cfgScale } : {},
11112
+ ...input.numInferenceSteps != null ? { num_inference_steps: input.numInferenceSteps } : {},
11113
+ ...input.videoQuality ? { video_quality: input.videoQuality } : {},
11114
+ ...input.videoWriteMode ? { video_write_mode: input.videoWriteMode } : {},
11115
+ ...input.seed != null ? { seed: input.seed } : {},
11116
+ enable_prompt_expansion: input.enhancePrompt ?? true,
11117
+ generate_audio: input.generateAudio ?? true,
11118
+ enable_safety_checker: input.enableSafetyChecker ?? true
11119
+ };
11120
+ };
11044
11121
  registerPayloads(MODELS2, {
11045
11122
  "ltx-v2.5-pro": buildLtx25ProT2VPayload,
11046
11123
  "ltx-v2.5-fast": buildLtx25FastT2VPayload,
@@ -14699,6 +14776,7 @@ var GptImage15 = "gpt-image-1.5";
14699
14776
  var GptImage2 = "gpt-image-2";
14700
14777
  var GptImage25Flare = "gpt-image-2.5-flare";
14701
14778
  var GptImage25Sunburst = "gpt-image-2.5-sunburst";
14779
+ var Grok47 = "grok-4.7";
14702
14780
  var GrokEditVideo = "grok-edit-video";
14703
14781
  var GrokExtendVideo = "grok-extend-video";
14704
14782
  var GrokImagineImage = "grok-imagine-image";
@@ -14962,6 +15040,7 @@ var Models = {
14962
15040
  GptImage2,
14963
15041
  GptImage25Flare,
14964
15042
  GptImage25Sunburst,
15043
+ Grok47,
14965
15044
  GrokEditVideo,
14966
15045
  GrokExtendVideo,
14967
15046
  GrokImagineImage,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picsart/ai-sdk",
3
- "version": "6.36.0",
3
+ "version": "6.38.0",
4
4
  "type": "module",
5
5
  "description": "Type-safe SDK for 100+ AI models — image, video, audio, and text generation with Picsart",
6
6
  "license": "MIT",