@aigne/openai 0.16.4-beta.5 → 0.16.4-beta.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.16.4-beta.6](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.4-beta.5...openai-v0.16.4-beta.6) (2025-10-31)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **models:** add image parameters support for video generation ([#684](https://github.com/AIGNE-io/aigne-framework/issues/684)) ([b048b7f](https://github.com/AIGNE-io/aigne-framework/commit/b048b7f92bd7a532dbdbeb6fb5fa5499bae6b953))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @aigne/core bumped to 1.65.0-beta.5
16
+ * devDependencies
17
+ * @aigne/test-utils bumped to 0.5.57-beta.6
18
+
3
19
  ## [0.16.4-beta.5](https://github.com/AIGNE-io/aigne-framework/compare/openai-v0.16.4-beta.4...openai-v0.16.4-beta.5) (2025-10-29)
4
20
 
5
21
 
@@ -1,4 +1,4 @@
1
- import { VideoModel, type VideoModelInput, type VideoModelOptions, type VideoModelOutput } from "@aigne/core";
1
+ import { type AgentInvokeOptions, VideoModel, type VideoModelInput, type VideoModelOptions, type VideoModelOutput } from "@aigne/core";
2
2
  import type OpenAI from "openai";
3
3
  import type { ClientOptions } from "openai";
4
4
  /**
@@ -6,9 +6,29 @@ import type { ClientOptions } from "openai";
6
6
  */
7
7
  export interface OpenAIVideoModelInput extends VideoModelInput {
8
8
  /**
9
- * Optional image reference that guides generation (file path or URL)
9
+ * Sora model to use for video generation
10
+ *
11
+ * - `sora-2`: Standard version, lower cost
12
+ * - `sora-2-pro`: Pro version, higher quality
13
+ *
14
+ * @default "sora-2"
15
+ */
16
+ model?: "sora-2" | "sora-2-pro";
17
+ /**
18
+ * Video resolution (width x height)
19
+ *
20
+ * - `720x1280`: Vertical video (9:16)
21
+ * - `1280x720`: Horizontal video (16:9)
22
+ * - `1024x1792`: Vertical video (9:16, higher resolution)
23
+ * - `1792x1024`: Horizontal video (16:9, higher resolution)
24
+ */
25
+ size?: "720x1280" | "1280x720" | "1024x1792" | "1792x1024";
26
+ /**
27
+ * Video duration in seconds
28
+ *
29
+ * @default "4"
10
30
  */
11
- inputReference?: string;
31
+ seconds?: "4" | "8" | "12";
12
32
  }
13
33
  /**
14
34
  * Output from OpenAI Video Model
@@ -68,5 +88,5 @@ export declare class OpenAIVideoModel extends VideoModel<OpenAIVideoModelInput,
68
88
  };
69
89
  get modelOptions(): Omit<Partial<OpenAIVideoModelInput>, "model"> | undefined;
70
90
  downloadToFile(videoId: string): Promise<string>;
71
- process(input: OpenAIVideoModelInput): Promise<OpenAIVideoModelOutput>;
91
+ process(input: OpenAIVideoModelInput, options: AgentInvokeOptions): Promise<OpenAIVideoModelOutput>;
72
92
  }
@@ -9,7 +9,9 @@ const openai_js_1 = require("./openai.js");
9
9
  const DEFAULT_MODEL = "sora-2";
10
10
  const DEFAULT_SECONDS = 4;
11
11
  const openAIVideoModelInputSchema = core_1.videoModelInputSchema.extend({
12
- inputReference: zod_1.z.string().optional(),
12
+ model: zod_1.z.enum(["sora-2", "sora-2-pro"]).optional(),
13
+ seconds: zod_1.z.enum(["4", "8", "12"]).optional(),
14
+ size: zod_1.z.enum(["720x1280", "1280x720", "1024x1792", "1792x1024"]).optional(),
13
15
  });
14
16
  const openAIVideoModelOptionsSchema = zod_1.z.object({
15
17
  apiKey: zod_1.z.string().optional(),
@@ -64,7 +66,7 @@ class OpenAIVideoModel extends core_1.VideoModel {
64
66
  const buffer = Buffer.from(arrayBuffer);
65
67
  return buffer.toString("base64");
66
68
  }
67
- async process(input) {
69
+ async process(input, options) {
68
70
  const model = input.model ?? input.modelOptions?.model ?? this.credential.model;
69
71
  const createParams = {
70
72
  model: model,
@@ -74,9 +76,10 @@ class OpenAIVideoModel extends core_1.VideoModel {
74
76
  createParams.seconds = input.seconds;
75
77
  if (input.size)
76
78
  createParams.size = input.size;
77
- if (input.inputReference) {
78
- createParams.input_reference =
79
- input.inputReference;
79
+ if (input.image) {
80
+ createParams.input_reference = await this.transformFileType("file", input.image, options).then((file) => new File([Buffer.from(file.data, "base64")], file.filename || "image.png", {
81
+ type: file.mimeType,
82
+ }));
80
83
  }
81
84
  let video = await this.client.videos.create(createParams);
82
85
  logger_js_1.logger.debug(`Video generation started: ${video.id}`);
@@ -1,4 +1,4 @@
1
- import { VideoModel, type VideoModelInput, type VideoModelOptions, type VideoModelOutput } from "@aigne/core";
1
+ import { type AgentInvokeOptions, VideoModel, type VideoModelInput, type VideoModelOptions, type VideoModelOutput } from "@aigne/core";
2
2
  import type OpenAI from "openai";
3
3
  import type { ClientOptions } from "openai";
4
4
  /**
@@ -6,9 +6,29 @@ import type { ClientOptions } from "openai";
6
6
  */
7
7
  export interface OpenAIVideoModelInput extends VideoModelInput {
8
8
  /**
9
- * Optional image reference that guides generation (file path or URL)
9
+ * Sora model to use for video generation
10
+ *
11
+ * - `sora-2`: Standard version, lower cost
12
+ * - `sora-2-pro`: Pro version, higher quality
13
+ *
14
+ * @default "sora-2"
15
+ */
16
+ model?: "sora-2" | "sora-2-pro";
17
+ /**
18
+ * Video resolution (width x height)
19
+ *
20
+ * - `720x1280`: Vertical video (9:16)
21
+ * - `1280x720`: Horizontal video (16:9)
22
+ * - `1024x1792`: Vertical video (9:16, higher resolution)
23
+ * - `1792x1024`: Horizontal video (16:9, higher resolution)
24
+ */
25
+ size?: "720x1280" | "1280x720" | "1024x1792" | "1792x1024";
26
+ /**
27
+ * Video duration in seconds
28
+ *
29
+ * @default "4"
10
30
  */
11
- inputReference?: string;
31
+ seconds?: "4" | "8" | "12";
12
32
  }
13
33
  /**
14
34
  * Output from OpenAI Video Model
@@ -68,5 +88,5 @@ export declare class OpenAIVideoModel extends VideoModel<OpenAIVideoModelInput,
68
88
  };
69
89
  get modelOptions(): Omit<Partial<OpenAIVideoModelInput>, "model"> | undefined;
70
90
  downloadToFile(videoId: string): Promise<string>;
71
- process(input: OpenAIVideoModelInput): Promise<OpenAIVideoModelOutput>;
91
+ process(input: OpenAIVideoModelInput, options: AgentInvokeOptions): Promise<OpenAIVideoModelOutput>;
72
92
  }
@@ -1,4 +1,4 @@
1
- import { VideoModel, type VideoModelInput, type VideoModelOptions, type VideoModelOutput } from "@aigne/core";
1
+ import { type AgentInvokeOptions, VideoModel, type VideoModelInput, type VideoModelOptions, type VideoModelOutput } from "@aigne/core";
2
2
  import type OpenAI from "openai";
3
3
  import type { ClientOptions } from "openai";
4
4
  /**
@@ -6,9 +6,29 @@ import type { ClientOptions } from "openai";
6
6
  */
7
7
  export interface OpenAIVideoModelInput extends VideoModelInput {
8
8
  /**
9
- * Optional image reference that guides generation (file path or URL)
9
+ * Sora model to use for video generation
10
+ *
11
+ * - `sora-2`: Standard version, lower cost
12
+ * - `sora-2-pro`: Pro version, higher quality
13
+ *
14
+ * @default "sora-2"
15
+ */
16
+ model?: "sora-2" | "sora-2-pro";
17
+ /**
18
+ * Video resolution (width x height)
19
+ *
20
+ * - `720x1280`: Vertical video (9:16)
21
+ * - `1280x720`: Horizontal video (16:9)
22
+ * - `1024x1792`: Vertical video (9:16, higher resolution)
23
+ * - `1792x1024`: Horizontal video (16:9, higher resolution)
24
+ */
25
+ size?: "720x1280" | "1280x720" | "1024x1792" | "1792x1024";
26
+ /**
27
+ * Video duration in seconds
28
+ *
29
+ * @default "4"
10
30
  */
11
- inputReference?: string;
31
+ seconds?: "4" | "8" | "12";
12
32
  }
13
33
  /**
14
34
  * Output from OpenAI Video Model
@@ -68,5 +88,5 @@ export declare class OpenAIVideoModel extends VideoModel<OpenAIVideoModelInput,
68
88
  };
69
89
  get modelOptions(): Omit<Partial<OpenAIVideoModelInput>, "model"> | undefined;
70
90
  downloadToFile(videoId: string): Promise<string>;
71
- process(input: OpenAIVideoModelInput): Promise<OpenAIVideoModelOutput>;
91
+ process(input: OpenAIVideoModelInput, options: AgentInvokeOptions): Promise<OpenAIVideoModelOutput>;
72
92
  }
@@ -6,7 +6,9 @@ import { CustomOpenAI } from "./openai.js";
6
6
  const DEFAULT_MODEL = "sora-2";
7
7
  const DEFAULT_SECONDS = 4;
8
8
  const openAIVideoModelInputSchema = videoModelInputSchema.extend({
9
- inputReference: z.string().optional(),
9
+ model: z.enum(["sora-2", "sora-2-pro"]).optional(),
10
+ seconds: z.enum(["4", "8", "12"]).optional(),
11
+ size: z.enum(["720x1280", "1280x720", "1024x1792", "1792x1024"]).optional(),
10
12
  });
11
13
  const openAIVideoModelOptionsSchema = z.object({
12
14
  apiKey: z.string().optional(),
@@ -61,7 +63,7 @@ export class OpenAIVideoModel extends VideoModel {
61
63
  const buffer = Buffer.from(arrayBuffer);
62
64
  return buffer.toString("base64");
63
65
  }
64
- async process(input) {
66
+ async process(input, options) {
65
67
  const model = input.model ?? input.modelOptions?.model ?? this.credential.model;
66
68
  const createParams = {
67
69
  model: model,
@@ -71,9 +73,10 @@ export class OpenAIVideoModel extends VideoModel {
71
73
  createParams.seconds = input.seconds;
72
74
  if (input.size)
73
75
  createParams.size = input.size;
74
- if (input.inputReference) {
75
- createParams.input_reference =
76
- input.inputReference;
76
+ if (input.image) {
77
+ createParams.input_reference = await this.transformFileType("file", input.image, options).then((file) => new File([Buffer.from(file.data, "base64")], file.filename || "image.png", {
78
+ type: file.mimeType,
79
+ }));
77
80
  }
78
81
  let video = await this.client.videos.create(createParams);
79
82
  logger.debug(`Video generation started: ${video.id}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/openai",
3
- "version": "0.16.4-beta.5",
3
+ "version": "0.16.4-beta.6",
4
4
  "description": "AIGNE OpenAI SDK for integrating with OpenAI's GPT models and API services",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -38,8 +38,8 @@
38
38
  "@aigne/uuid": "^13.0.1",
39
39
  "openai": "^6.5.0",
40
40
  "zod": "^3.25.67",
41
- "@aigne/core": "^1.65.0-beta.4",
42
- "@aigne/platform-helpers": "^0.6.3"
41
+ "@aigne/platform-helpers": "^0.6.3",
42
+ "@aigne/core": "^1.65.0-beta.5"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/bun": "^1.2.22",
@@ -47,7 +47,7 @@
47
47
  "npm-run-all": "^4.1.5",
48
48
  "rimraf": "^6.0.1",
49
49
  "typescript": "^5.9.2",
50
- "@aigne/test-utils": "^0.5.57-beta.5"
50
+ "@aigne/test-utils": "^0.5.57-beta.6"
51
51
  },
52
52
  "scripts": {
53
53
  "lint": "tsc --noEmit",