@runapi.ai/gemini-omni 0.2.7 → 0.2.8
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 +2 -2
- package/dist/index.js +86 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Gemini Omni
|
|
1
|
+
# Gemini Omni JavaScript SDK for RunAPI
|
|
2
2
|
|
|
3
|
-
The
|
|
3
|
+
The Gemini Omni JavaScript SDK is the language-specific package for Gemini Omni on RunAPI. Use this package for voice resources, character resources, and multimodal video generation workflows when your application needs request bodies, task status lookup, and consistent RunAPI errors in JavaScript.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,82 @@ var import_core4 = require("@runapi.ai/core");
|
|
|
38
38
|
|
|
39
39
|
// src/resources/create-audio.ts
|
|
40
40
|
var import_core = require("@runapi.ai/core");
|
|
41
|
+
|
|
42
|
+
// src/contract_gen.ts
|
|
43
|
+
var contract = {
|
|
44
|
+
"create-audio": {
|
|
45
|
+
"models": [
|
|
46
|
+
"gemini-omni-audio"
|
|
47
|
+
],
|
|
48
|
+
"fields_by_model": {
|
|
49
|
+
"gemini-omni-audio": {
|
|
50
|
+
"audio_id": {
|
|
51
|
+
"required": true
|
|
52
|
+
},
|
|
53
|
+
"name": {
|
|
54
|
+
"required": true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"create-character": {
|
|
60
|
+
"models": [
|
|
61
|
+
"gemini-omni-character"
|
|
62
|
+
],
|
|
63
|
+
"fields_by_model": {
|
|
64
|
+
"gemini-omni-character": {
|
|
65
|
+
"descriptions": {
|
|
66
|
+
"required": true
|
|
67
|
+
},
|
|
68
|
+
"reference_image_url": {
|
|
69
|
+
"required": true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"text-to-video": {
|
|
75
|
+
"models": [
|
|
76
|
+
"gemini-omni-text-to-video"
|
|
77
|
+
],
|
|
78
|
+
"fields_by_model": {
|
|
79
|
+
"gemini-omni-text-to-video": {
|
|
80
|
+
"aspect_ratio": {
|
|
81
|
+
"enum": [
|
|
82
|
+
"16:9",
|
|
83
|
+
"9:16"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"duration_seconds": {
|
|
87
|
+
"enum": [
|
|
88
|
+
4,
|
|
89
|
+
6,
|
|
90
|
+
8,
|
|
91
|
+
10
|
|
92
|
+
],
|
|
93
|
+
"required": true,
|
|
94
|
+
"type": "integer"
|
|
95
|
+
},
|
|
96
|
+
"output_resolution": {
|
|
97
|
+
"enum": [
|
|
98
|
+
"720p",
|
|
99
|
+
"1080p",
|
|
100
|
+
"4k"
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
"prompt": {
|
|
104
|
+
"required": true
|
|
105
|
+
},
|
|
106
|
+
"seed": {
|
|
107
|
+
"type": "integer"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// src/resources/create-audio.ts
|
|
41
115
|
var ENDPOINT = "/api/v1/gemini_omni/create_audio";
|
|
116
|
+
var MODEL = "gemini-omni-audio";
|
|
42
117
|
var CreateAudio = class {
|
|
43
118
|
constructor(http) {
|
|
44
119
|
this.http = http;
|
|
@@ -51,8 +126,10 @@ var CreateAudio = class {
|
|
|
51
126
|
* @returns The created audio voice preset.
|
|
52
127
|
*/
|
|
53
128
|
async run(params, options) {
|
|
129
|
+
const body = (0, import_core.compactParams)(params);
|
|
130
|
+
(0, import_core.validateParams)(contract["create-audio"], { ...body, model: MODEL });
|
|
54
131
|
return this.http.request("POST", ENDPOINT, {
|
|
55
|
-
body
|
|
132
|
+
body,
|
|
56
133
|
...options
|
|
57
134
|
});
|
|
58
135
|
}
|
|
@@ -61,6 +138,7 @@ var CreateAudio = class {
|
|
|
61
138
|
// src/resources/create-character.ts
|
|
62
139
|
var import_core2 = require("@runapi.ai/core");
|
|
63
140
|
var ENDPOINT2 = "/api/v1/gemini_omni/create_character";
|
|
141
|
+
var MODEL2 = "gemini-omni-character";
|
|
64
142
|
var CreateCharacter = class {
|
|
65
143
|
constructor(http) {
|
|
66
144
|
this.http = http;
|
|
@@ -73,8 +151,10 @@ var CreateCharacter = class {
|
|
|
73
151
|
* @returns The created character.
|
|
74
152
|
*/
|
|
75
153
|
async run(params, options) {
|
|
154
|
+
const body = (0, import_core2.compactParams)(params);
|
|
155
|
+
(0, import_core2.validateParams)(contract["create-character"], { ...body, model: MODEL2 });
|
|
76
156
|
return this.http.request("POST", ENDPOINT2, {
|
|
77
|
-
body
|
|
157
|
+
body,
|
|
78
158
|
...options
|
|
79
159
|
});
|
|
80
160
|
}
|
|
@@ -84,6 +164,7 @@ var CreateCharacter = class {
|
|
|
84
164
|
var import_core3 = require("@runapi.ai/core");
|
|
85
165
|
var import_internal = require("@runapi.ai/core/internal");
|
|
86
166
|
var ENDPOINT3 = "/api/v1/gemini_omni/text_to_video";
|
|
167
|
+
var MODEL3 = "gemini-omni-text-to-video";
|
|
87
168
|
var TextToVideo = class {
|
|
88
169
|
constructor(http) {
|
|
89
170
|
this.http = http;
|
|
@@ -110,8 +191,10 @@ var TextToVideo = class {
|
|
|
110
191
|
* @returns The task creation result with id.
|
|
111
192
|
*/
|
|
112
193
|
async create(params, options) {
|
|
194
|
+
const body = (0, import_core3.compactParams)(params);
|
|
195
|
+
(0, import_core3.validateParams)(contract["text-to-video"], { ...body, model: MODEL3 });
|
|
113
196
|
return this.http.request("POST", ENDPOINT3, {
|
|
114
|
-
body
|
|
197
|
+
body,
|
|
115
198
|
...options
|
|
116
199
|
});
|
|
117
200
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/create-audio.ts","../src/resources/create-character.ts","../src/resources/text-to-video.ts"],"sourcesContent":["export { GeminiOmniClient } from './client';\nexport * from './types';\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { CreateAudio } from './resources/create-audio';\nimport { CreateCharacter } from './resources/create-character';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * Gemini Omni multimodal generation client for voice presets, character creation,\n * and text-to-video with optional characters, audio voices, and reference media.\n *\n * @example\n * ```typescript\n * import { GeminiOmniClient } from '@runapi.ai/gemini-omni';\n * const client = new GeminiOmniClient({ apiKey: 'sk-...' });\n *\n * // Create a voice preset, then generate a video using it\n * const audio = await client.createAudio.run({\n * audio_id: 'zephyr',\n * name: 'Narrator',\n * });\n * const video = await client.textToVideo.run({\n * prompt: 'A narrator walks through a futuristic city',\n * duration_seconds: 6,\n * audio_ids: [audio.audio!.id],\n * });\n * console.log(video.videos[0].url);\n * ```\n */\nexport class GeminiOmniClient extends BaseClient {\n /** Registers a reusable voice preset from a built-in voice identity (synchronous). */\n public readonly createAudio: CreateAudio;\n /** Builds a reusable character from a reference image and description (synchronous). */\n public readonly createCharacter: CreateCharacter;\n /** Generates video from a prompt with optional characters, voices, images, and clips (async with polling). */\n public readonly textToVideo: TextToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.createAudio = new CreateAudio(this.http);\n this.createCharacter = new CreateCharacter(this.http);\n this.textToVideo = new TextToVideo(this.http);\n }\n}\n","import type { HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport type { CreateAudioParams, CreateAudioResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/create_audio';\n\n/**\n * Registers a reusable voice preset from a built-in voice identity.\n * This is a synchronous operation -- only `run()` is available (no create/get polling).\n */\nexport class CreateAudio {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Register a reusable voice preset (synchronous).\n * @param params Voice preset parameters.\n * @param options Per-request overrides.\n * @returns The created audio voice preset.\n */\n async run(params: CreateAudioParams, options?: RequestOptions): Promise<CreateAudioResponse> {\n return this.http.request<CreateAudioResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport type { CreateCharacterParams, CreateCharacterResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/create_character';\n\n/**\n * Builds a reusable character from a reference image and description.\n * Attach audio IDs to give the character a specific voice.\n * This is a synchronous operation -- only `run()` is available (no create/get polling).\n */\nexport class CreateCharacter {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Build a reusable character (synchronous).\n * @param params Character creation parameters.\n * @param options Per-request overrides.\n * @returns The created character.\n */\n async run(params: CreateCharacterParams, options?: RequestOptions): Promise<CreateCharacterResponse> {\n return this.http.request<CreateCharacterResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TaskCreateResponse,\n TextToVideoParams,\n TextToVideoResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/text_to_video';\n\n/**\n * Generates video from a prompt with optional characters, audio voices, reference images, and video clips.\n * This is an async operation -- use `run()` for automatic polling or `create()`/`get()` for manual control.\n */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text-to-video result.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-video status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8B;AAG9B,IAAM,WAAW;AAMV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAwD;AAC3F,WAAO,KAAK,KAAK,QAA6B,QAAQ,UAAU;AAAA,MAC9D,UAAM,2BAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;ACxBA,IAAAC,eAA8B;AAG9B,IAAMC,YAAW;AAOV,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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gB,KAAK,IAAI;AACpD,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAAA,EAC9C;AACF;;;ADvCA,IAAAC,eAUO;","names":["import_core","import_core","ENDPOINT","import_core","ENDPOINT","import_core"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/resources/create-audio.ts","../src/contract_gen.ts","../src/resources/create-character.ts","../src/resources/text-to-video.ts"],"sourcesContent":["export { GeminiOmniClient } from './client';\nexport * from './types';\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n} from '@runapi.ai/core';\n","import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { CreateAudio } from './resources/create-audio';\nimport { CreateCharacter } from './resources/create-character';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * Gemini Omni multimodal generation client for voice presets, character creation,\n * and text-to-video with optional characters, audio voices, and reference media.\n *\n * @example\n * ```typescript\n * import { GeminiOmniClient } from '@runapi.ai/gemini-omni';\n * const client = new GeminiOmniClient({ apiKey: 'sk-...' });\n *\n * // Create a voice preset, then generate a video using it\n * const audio = await client.createAudio.run({\n * audio_id: 'zephyr',\n * name: 'Narrator',\n * });\n * const video = await client.textToVideo.run({\n * prompt: 'A narrator walks through a futuristic city',\n * duration_seconds: 6,\n * audio_ids: [audio.audio!.id],\n * });\n * console.log(video.videos[0].url);\n * ```\n */\nexport class GeminiOmniClient extends BaseClient {\n /** Registers a reusable voice preset from a built-in voice identity (synchronous). */\n public readonly createAudio: CreateAudio;\n /** Builds a reusable character from a reference image and description (synchronous). */\n public readonly createCharacter: CreateCharacter;\n /** Generates video from a prompt with optional characters, voices, images, and clips (async with polling). */\n public readonly textToVideo: TextToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.createAudio = new CreateAudio(this.http);\n this.createCharacter = new CreateCharacter(this.http);\n this.textToVideo = new TextToVideo(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { CreateAudioParams, CreateAudioResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/create_audio';\n\n// Fixed endpoint model, injected only for contract validation (never sent on the wire).\nconst MODEL = 'gemini-omni-audio';\n\n/**\n * Registers a reusable voice preset from a built-in voice identity.\n * This is a synchronous operation -- only `run()` is available (no create/get polling).\n */\nexport class CreateAudio {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Register a reusable voice preset (synchronous).\n * @param params Voice preset parameters.\n * @param options Per-request overrides.\n * @returns The created audio voice preset.\n */\n async run(params: CreateAudioParams, options?: RequestOptions): Promise<CreateAudioResponse> {\n const body = compactParams(params);\n validateParams(contract['create-audio'] as ActionSchema, { ...body, model: MODEL } as Record<string, unknown>);\n return this.http.request<CreateAudioResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n}\n","export const contract = {\n \"create-audio\": {\n \"models\": [\n \"gemini-omni-audio\"\n ],\n \"fields_by_model\": {\n \"gemini-omni-audio\": {\n \"audio_id\": {\n \"required\": true\n },\n \"name\": {\n \"required\": true\n }\n }\n }\n },\n \"create-character\": {\n \"models\": [\n \"gemini-omni-character\"\n ],\n \"fields_by_model\": {\n \"gemini-omni-character\": {\n \"descriptions\": {\n \"required\": true\n },\n \"reference_image_url\": {\n \"required\": true\n }\n }\n }\n },\n \"text-to-video\": {\n \"models\": [\n \"gemini-omni-text-to-video\"\n ],\n \"fields_by_model\": {\n \"gemini-omni-text-to-video\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\"\n ]\n },\n \"duration_seconds\": {\n \"enum\": [\n 4,\n 6,\n 8,\n 10\n ],\n \"required\": true,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\",\n \"4k\"\n ]\n },\n \"prompt\": {\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { CreateCharacterParams, CreateCharacterResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/create_character';\n\n// Fixed endpoint model, injected only for contract validation (never sent on the wire).\nconst MODEL = 'gemini-omni-character';\n\n/**\n * Builds a reusable character from a reference image and description.\n * Attach audio IDs to give the character a specific voice.\n * This is a synchronous operation -- only `run()` is available (no create/get polling).\n */\nexport class CreateCharacter {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Build a reusable character (synchronous).\n * @param params Character creation parameters.\n * @param options Per-request overrides.\n * @returns The created character.\n */\n async run(params: CreateCharacterParams, options?: RequestOptions): Promise<CreateCharacterResponse> {\n const body = compactParams(params);\n validateParams(contract['create-character'] as ActionSchema, { ...body, model: MODEL } as Record<string, unknown>);\n return this.http.request<CreateCharacterResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToVideoResponse,\n TaskCreateResponse,\n TextToVideoParams,\n TextToVideoResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/text_to_video';\n\n// Fixed endpoint model, injected only for contract validation (never sent on the wire).\nconst MODEL = 'gemini-omni-text-to-video';\n\n/**\n * Generates video from a prompt with optional characters, audio voices, reference images, and video clips.\n * This is an async operation -- use `run()` for automatic polling or `create()`/`get()` for manual control.\n */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text-to-video result.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-video'] as ActionSchema, { ...body, model: MODEL } as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-video status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,eAA+C;;;ACC/C,kBAA8C;;;ACDvC,IAAM,WAAW;AAAA,EACtB,gBAAgB;AAAA,IACd,UAAU;AAAA,MACR;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,qBAAqB;AAAA,QACnB,YAAY;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,QAAQ;AAAA,UACN,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,oBAAoB;AAAA,IAClB,UAAU;AAAA,MACR;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,yBAAyB;AAAA,QACvB,gBAAgB;AAAA,UACd,YAAY;AAAA,QACd;AAAA,QACA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B;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAEhB,YAAY,UAAyB,CAAC,GAAG;AACvC,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,kBAAkB,IAAI,gBAAgB,KAAK,IAAI;AACpD,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAAA,EAC9C;AACF;;;ADvCA,IAAAE,eAUO;","names":["import_core","import_core","ENDPOINT","MODEL","import_core","ENDPOINT","MODEL","import_core"]}
|
package/dist/index.mjs
CHANGED
|
@@ -2,8 +2,83 @@
|
|
|
2
2
|
import { BaseClient } from "@runapi.ai/core";
|
|
3
3
|
|
|
4
4
|
// src/resources/create-audio.ts
|
|
5
|
-
import { compactParams } from "@runapi.ai/core";
|
|
5
|
+
import { compactParams, validateParams } from "@runapi.ai/core";
|
|
6
|
+
|
|
7
|
+
// src/contract_gen.ts
|
|
8
|
+
var contract = {
|
|
9
|
+
"create-audio": {
|
|
10
|
+
"models": [
|
|
11
|
+
"gemini-omni-audio"
|
|
12
|
+
],
|
|
13
|
+
"fields_by_model": {
|
|
14
|
+
"gemini-omni-audio": {
|
|
15
|
+
"audio_id": {
|
|
16
|
+
"required": true
|
|
17
|
+
},
|
|
18
|
+
"name": {
|
|
19
|
+
"required": true
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"create-character": {
|
|
25
|
+
"models": [
|
|
26
|
+
"gemini-omni-character"
|
|
27
|
+
],
|
|
28
|
+
"fields_by_model": {
|
|
29
|
+
"gemini-omni-character": {
|
|
30
|
+
"descriptions": {
|
|
31
|
+
"required": true
|
|
32
|
+
},
|
|
33
|
+
"reference_image_url": {
|
|
34
|
+
"required": true
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"text-to-video": {
|
|
40
|
+
"models": [
|
|
41
|
+
"gemini-omni-text-to-video"
|
|
42
|
+
],
|
|
43
|
+
"fields_by_model": {
|
|
44
|
+
"gemini-omni-text-to-video": {
|
|
45
|
+
"aspect_ratio": {
|
|
46
|
+
"enum": [
|
|
47
|
+
"16:9",
|
|
48
|
+
"9:16"
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"duration_seconds": {
|
|
52
|
+
"enum": [
|
|
53
|
+
4,
|
|
54
|
+
6,
|
|
55
|
+
8,
|
|
56
|
+
10
|
|
57
|
+
],
|
|
58
|
+
"required": true,
|
|
59
|
+
"type": "integer"
|
|
60
|
+
},
|
|
61
|
+
"output_resolution": {
|
|
62
|
+
"enum": [
|
|
63
|
+
"720p",
|
|
64
|
+
"1080p",
|
|
65
|
+
"4k"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"prompt": {
|
|
69
|
+
"required": true
|
|
70
|
+
},
|
|
71
|
+
"seed": {
|
|
72
|
+
"type": "integer"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// src/resources/create-audio.ts
|
|
6
80
|
var ENDPOINT = "/api/v1/gemini_omni/create_audio";
|
|
81
|
+
var MODEL = "gemini-omni-audio";
|
|
7
82
|
var CreateAudio = class {
|
|
8
83
|
constructor(http) {
|
|
9
84
|
this.http = http;
|
|
@@ -16,16 +91,19 @@ var CreateAudio = class {
|
|
|
16
91
|
* @returns The created audio voice preset.
|
|
17
92
|
*/
|
|
18
93
|
async run(params, options) {
|
|
94
|
+
const body = compactParams(params);
|
|
95
|
+
validateParams(contract["create-audio"], { ...body, model: MODEL });
|
|
19
96
|
return this.http.request("POST", ENDPOINT, {
|
|
20
|
-
body
|
|
97
|
+
body,
|
|
21
98
|
...options
|
|
22
99
|
});
|
|
23
100
|
}
|
|
24
101
|
};
|
|
25
102
|
|
|
26
103
|
// src/resources/create-character.ts
|
|
27
|
-
import { compactParams as compactParams2 } from "@runapi.ai/core";
|
|
104
|
+
import { compactParams as compactParams2, validateParams as validateParams2 } from "@runapi.ai/core";
|
|
28
105
|
var ENDPOINT2 = "/api/v1/gemini_omni/create_character";
|
|
106
|
+
var MODEL2 = "gemini-omni-character";
|
|
29
107
|
var CreateCharacter = class {
|
|
30
108
|
constructor(http) {
|
|
31
109
|
this.http = http;
|
|
@@ -38,17 +116,20 @@ var CreateCharacter = class {
|
|
|
38
116
|
* @returns The created character.
|
|
39
117
|
*/
|
|
40
118
|
async run(params, options) {
|
|
119
|
+
const body = compactParams2(params);
|
|
120
|
+
validateParams2(contract["create-character"], { ...body, model: MODEL2 });
|
|
41
121
|
return this.http.request("POST", ENDPOINT2, {
|
|
42
|
-
body
|
|
122
|
+
body,
|
|
43
123
|
...options
|
|
44
124
|
});
|
|
45
125
|
}
|
|
46
126
|
};
|
|
47
127
|
|
|
48
128
|
// src/resources/text-to-video.ts
|
|
49
|
-
import { compactParams as compactParams3 } from "@runapi.ai/core";
|
|
129
|
+
import { compactParams as compactParams3, validateParams as validateParams3 } from "@runapi.ai/core";
|
|
50
130
|
import { pollUntilComplete } from "@runapi.ai/core/internal";
|
|
51
131
|
var ENDPOINT3 = "/api/v1/gemini_omni/text_to_video";
|
|
132
|
+
var MODEL3 = "gemini-omni-text-to-video";
|
|
52
133
|
var TextToVideo = class {
|
|
53
134
|
constructor(http) {
|
|
54
135
|
this.http = http;
|
|
@@ -75,8 +156,10 @@ var TextToVideo = class {
|
|
|
75
156
|
* @returns The task creation result with id.
|
|
76
157
|
*/
|
|
77
158
|
async create(params, options) {
|
|
159
|
+
const body = compactParams3(params);
|
|
160
|
+
validateParams3(contract["text-to-video"], { ...body, model: MODEL3 });
|
|
78
161
|
return this.http.request("POST", ENDPOINT3, {
|
|
79
|
-
body
|
|
162
|
+
body,
|
|
80
163
|
...options
|
|
81
164
|
});
|
|
82
165
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts","../src/resources/create-audio.ts","../src/resources/create-character.ts","../src/resources/text-to-video.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { CreateAudio } from './resources/create-audio';\nimport { CreateCharacter } from './resources/create-character';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * Gemini Omni multimodal generation client for voice presets, character creation,\n * and text-to-video with optional characters, audio voices, and reference media.\n *\n * @example\n * ```typescript\n * import { GeminiOmniClient } from '@runapi.ai/gemini-omni';\n * const client = new GeminiOmniClient({ apiKey: 'sk-...' });\n *\n * // Create a voice preset, then generate a video using it\n * const audio = await client.createAudio.run({\n * audio_id: 'zephyr',\n * name: 'Narrator',\n * });\n * const video = await client.textToVideo.run({\n * prompt: 'A narrator walks through a futuristic city',\n * duration_seconds: 6,\n * audio_ids: [audio.audio!.id],\n * });\n * console.log(video.videos[0].url);\n * ```\n */\nexport class GeminiOmniClient extends BaseClient {\n /** Registers a reusable voice preset from a built-in voice identity (synchronous). */\n public readonly createAudio: CreateAudio;\n /** Builds a reusable character from a reference image and description (synchronous). */\n public readonly createCharacter: CreateCharacter;\n /** Generates video from a prompt with optional characters, voices, images, and clips (async with polling). */\n public readonly textToVideo: TextToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.createAudio = new CreateAudio(this.http);\n this.createCharacter = new CreateCharacter(this.http);\n this.textToVideo = new TextToVideo(this.http);\n }\n}\n","import type { HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport type { CreateAudioParams, CreateAudioResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/create_audio';\n\n/**\n * Registers a reusable voice preset from a built-in voice identity.\n * This is a synchronous operation -- only `run()` is available (no create/get polling).\n */\nexport class CreateAudio {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Register a reusable voice preset (synchronous).\n * @param params Voice preset parameters.\n * @param options Per-request overrides.\n * @returns The created audio voice preset.\n */\n async run(params: CreateAudioParams, options?: RequestOptions): Promise<CreateAudioResponse> {\n return this.http.request<CreateAudioResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport type { CreateCharacterParams, CreateCharacterResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/create_character';\n\n/**\n * Builds a reusable character from a reference image and description.\n * Attach audio IDs to give the character a specific voice.\n * This is a synchronous operation -- only `run()` is available (no create/get polling).\n */\nexport class CreateCharacter {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Build a reusable character (synchronous).\n * @param params Character creation parameters.\n * @param options Per-request overrides.\n * @returns The created character.\n */\n async run(params: CreateCharacterParams, options?: RequestOptions): Promise<CreateCharacterResponse> {\n return this.http.request<CreateCharacterResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions } from '@runapi.ai/core';\nimport { compactParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport type {\n CompletedTextToVideoResponse,\n TaskCreateResponse,\n TextToVideoParams,\n TextToVideoResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/text_to_video';\n\n/**\n * Generates video from a prompt with optional characters, audio voices, reference images, and video clips.\n * This is an async operation -- use `run()` for automatic polling or `create()`/`get()` for manual control.\n */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text-to-video result.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body: compactParams(params),\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-video status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { GeminiOmniClient } from './client';\nexport * from './types';\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,qBAAqB;AAG9B,IAAM,WAAW;AAMV,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA2B,SAAwD;AAC3F,WAAO,KAAK,KAAK,QAA6B,QAAQ,UAAU;AAAA,MAC9D,MAAM,cAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;ACxBA,SAAS,iBAAAA,sBAAqB;AAG9B,IAAMC,YAAW;AAOV,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAA6B,MAAkB;AAAlB;AAAA,EAAmB;AAAA,EAAnB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ7B,MAAM,IAAI,QAA+B,SAA4D;AACnG,WAAO,KAAK,KAAK,QAAiC,QAAQA,WAAU;AAAA,MAClE,MAAMD,eAAc,MAAM;AAAA,MAC1B,GAAG;AAAA,IACL,CA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;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","ENDPOINT","compactParams","ENDPOINT"]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts","../src/resources/create-audio.ts","../src/contract_gen.ts","../src/resources/create-character.ts","../src/resources/text-to-video.ts","../src/index.ts"],"sourcesContent":["import { BaseClient, type ClientOptions } from '@runapi.ai/core';\nimport { CreateAudio } from './resources/create-audio';\nimport { CreateCharacter } from './resources/create-character';\nimport { TextToVideo } from './resources/text-to-video';\n\n/**\n * Gemini Omni multimodal generation client for voice presets, character creation,\n * and text-to-video with optional characters, audio voices, and reference media.\n *\n * @example\n * ```typescript\n * import { GeminiOmniClient } from '@runapi.ai/gemini-omni';\n * const client = new GeminiOmniClient({ apiKey: 'sk-...' });\n *\n * // Create a voice preset, then generate a video using it\n * const audio = await client.createAudio.run({\n * audio_id: 'zephyr',\n * name: 'Narrator',\n * });\n * const video = await client.textToVideo.run({\n * prompt: 'A narrator walks through a futuristic city',\n * duration_seconds: 6,\n * audio_ids: [audio.audio!.id],\n * });\n * console.log(video.videos[0].url);\n * ```\n */\nexport class GeminiOmniClient extends BaseClient {\n /** Registers a reusable voice preset from a built-in voice identity (synchronous). */\n public readonly createAudio: CreateAudio;\n /** Builds a reusable character from a reference image and description (synchronous). */\n public readonly createCharacter: CreateCharacter;\n /** Generates video from a prompt with optional characters, voices, images, and clips (async with polling). */\n public readonly textToVideo: TextToVideo;\n\n constructor(options: ClientOptions = {}) {\n super(options);\n this.createAudio = new CreateAudio(this.http);\n this.createCharacter = new CreateCharacter(this.http);\n this.textToVideo = new TextToVideo(this.http);\n }\n}\n","import type { HttpClient, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { CreateAudioParams, CreateAudioResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/create_audio';\n\n// Fixed endpoint model, injected only for contract validation (never sent on the wire).\nconst MODEL = 'gemini-omni-audio';\n\n/**\n * Registers a reusable voice preset from a built-in voice identity.\n * This is a synchronous operation -- only `run()` is available (no create/get polling).\n */\nexport class CreateAudio {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Register a reusable voice preset (synchronous).\n * @param params Voice preset parameters.\n * @param options Per-request overrides.\n * @returns The created audio voice preset.\n */\n async run(params: CreateAudioParams, options?: RequestOptions): Promise<CreateAudioResponse> {\n const body = compactParams(params);\n validateParams(contract['create-audio'] as ActionSchema, { ...body, model: MODEL } as Record<string, unknown>);\n return this.http.request<CreateAudioResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n}\n","export const contract = {\n \"create-audio\": {\n \"models\": [\n \"gemini-omni-audio\"\n ],\n \"fields_by_model\": {\n \"gemini-omni-audio\": {\n \"audio_id\": {\n \"required\": true\n },\n \"name\": {\n \"required\": true\n }\n }\n }\n },\n \"create-character\": {\n \"models\": [\n \"gemini-omni-character\"\n ],\n \"fields_by_model\": {\n \"gemini-omni-character\": {\n \"descriptions\": {\n \"required\": true\n },\n \"reference_image_url\": {\n \"required\": true\n }\n }\n }\n },\n \"text-to-video\": {\n \"models\": [\n \"gemini-omni-text-to-video\"\n ],\n \"fields_by_model\": {\n \"gemini-omni-text-to-video\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\"\n ]\n },\n \"duration_seconds\": {\n \"enum\": [\n 4,\n 6,\n 8,\n 10\n ],\n \"required\": true,\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\",\n \"1080p\",\n \"4k\"\n ]\n },\n \"prompt\": {\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n }\n }\n }\n} as const;\n","import type { HttpClient, RequestOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { contract } from '../contract_gen';\nimport type { CreateCharacterParams, CreateCharacterResponse } from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/create_character';\n\n// Fixed endpoint model, injected only for contract validation (never sent on the wire).\nconst MODEL = 'gemini-omni-character';\n\n/**\n * Builds a reusable character from a reference image and description.\n * Attach audio IDs to give the character a specific voice.\n * This is a synchronous operation -- only `run()` is available (no create/get polling).\n */\nexport class CreateCharacter {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Build a reusable character (synchronous).\n * @param params Character creation parameters.\n * @param options Per-request overrides.\n * @returns The created character.\n */\n async run(params: CreateCharacterParams, options?: RequestOptions): Promise<CreateCharacterResponse> {\n const body = compactParams(params);\n validateParams(contract['create-character'] as ActionSchema, { ...body, model: MODEL } as Record<string, unknown>);\n return this.http.request<CreateCharacterResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n}\n","import type { HttpClient, RequestOptions, PollingOptions, ActionSchema } from '@runapi.ai/core';\nimport { compactParams, validateParams } from '@runapi.ai/core';\nimport { pollUntilComplete } from '@runapi.ai/core/internal';\nimport { contract } from '../contract_gen';\nimport type {\n CompletedTextToVideoResponse,\n TaskCreateResponse,\n TextToVideoParams,\n TextToVideoResponse,\n} from '../types';\n\nconst ENDPOINT = '/api/v1/gemini_omni/text_to_video';\n\n// Fixed endpoint model, injected only for contract validation (never sent on the wire).\nconst MODEL = 'gemini-omni-text-to-video';\n\n/**\n * Generates video from a prompt with optional characters, audio voices, reference images, and video clips.\n * This is an async operation -- use `run()` for automatic polling or `create()`/`get()` for manual control.\n */\nexport class TextToVideo {\n constructor(private readonly http: HttpClient) {}\n\n /**\n * Generate a video and wait until complete.\n * @param params Text-to-video parameters.\n * @param options Per-request and polling overrides.\n * @returns The completed text-to-video result.\n */\n async run(params: TextToVideoParams, options?: RequestOptions & PollingOptions): Promise<CompletedTextToVideoResponse> {\n const { id } = await this.create(params, options);\n const response = await pollUntilComplete<TextToVideoResponse>(() => this.get(id, options), {\n maxWaitMs: options?.maxWaitMs,\n pollIntervalMs: options?.pollIntervalMs,\n });\n return response as CompletedTextToVideoResponse;\n }\n\n /**\n * Create a text-to-video task; returns immediately with a task id.\n * @param params Text-to-video parameters.\n * @param options Per-request overrides.\n * @returns The task creation result with id.\n */\n async create(params: TextToVideoParams, options?: RequestOptions): Promise<TaskCreateResponse> {\n const body = compactParams(params);\n validateParams(contract['text-to-video'] as ActionSchema, { ...body, model: MODEL } as Record<string, unknown>);\n return this.http.request<TaskCreateResponse>('POST', ENDPOINT, {\n body,\n ...options,\n });\n }\n\n /**\n * Fetch the current status of a text-to-video task.\n * @param id The task id.\n * @param options Per-request overrides.\n * @returns The current text-to-video status.\n */\n async get(id: string, options?: RequestOptions): Promise<TextToVideoResponse> {\n return this.http.request<TextToVideoResponse>('GET', `${ENDPOINT}/${id}`, {\n ...options,\n });\n }\n}\n","export { GeminiOmniClient } from './client';\nexport * from './types';\nexport {\n RunApiError,\n AuthenticationError,\n InsufficientCreditsError,\n NotFoundError,\n ValidationError,\n RateLimitError,\n ServiceUnavailableError,\n NetworkError,\n TimeoutError,\n} from '@runapi.ai/core';\n"],"mappings":";AAAA,SAAS,kBAAsC;;;ACC/C,SAAS,eAAe,sBAAsB;;;ACDvC,IAAM,WAAW;AAAA,EACtB,gBAAgB;AAAA,IACd,UAAU;AAAA,MACR;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,qBAAqB;AAAA,QACnB,YAAY;AAAA,UACV,YAAY;AAAA,QACd;AAAA,QACA,QAAQ;AAAA,UACN,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,oBAAoB;AAAA,IAClB,UAAU;AAAA,MACR;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,yBAAyB;AAAA,QACvB,gBAAgB;AAAA,UACd,YAAY;AAAA,QACd;AAAA,QACA,uBAAuB;AAAA,UACrB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,UAAU;AAAA,MACR;AAAA,IACF;AAAA,IACA,mBAAmB;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,UAAM,OAAO;AACb,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAC5C,SAAK,kBAAkB,IAAI,gBAAgB,KAAK,IAAI;AACpD,SAAK,cAAc,IAAI,YAAY,KAAK,IAAI;AAAA,EAC9C;AACF;;;AKvCA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":["compactParams","validateParams","ENDPOINT","MODEL","compactParams","validateParams","compactParams","validateParams","ENDPOINT","MODEL","compactParams","validateParams"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runapi.ai/gemini-omni",
|
|
3
|
-
"
|
|
4
|
-
|
|
3
|
+
"runapi": {
|
|
4
|
+
"slug": "gemini-omni"
|
|
5
|
+
},
|
|
6
|
+
"version": "0.2.8",
|
|
7
|
+
"description": "RunAPI Gemini Omni SDK for audio, character, and video workflows in JavaScript, Python, Ruby, Go, Java, and PHP",
|
|
5
8
|
"main": "./dist/index.js",
|
|
6
9
|
"module": "./dist/index.mjs",
|
|
7
10
|
"types": "./dist/index.d.ts",
|
|
@@ -28,7 +31,7 @@
|
|
|
28
31
|
"clean": "rm -rf dist"
|
|
29
32
|
},
|
|
30
33
|
"dependencies": {
|
|
31
|
-
"@runapi.ai/core": "^0.2.
|
|
34
|
+
"@runapi.ai/core": "^0.2.11"
|
|
32
35
|
},
|
|
33
36
|
"devDependencies": {
|
|
34
37
|
"@types/node": "^20.0.0",
|
|
@@ -49,12 +52,17 @@
|
|
|
49
52
|
"audio",
|
|
50
53
|
"character",
|
|
51
54
|
"video",
|
|
52
|
-
"image",
|
|
53
55
|
"api",
|
|
54
56
|
"sdk",
|
|
55
57
|
"typescript",
|
|
58
|
+
"python",
|
|
56
59
|
"ruby",
|
|
57
|
-
"golang"
|
|
60
|
+
"golang",
|
|
61
|
+
"java",
|
|
62
|
+
"maven",
|
|
63
|
+
"gradle",
|
|
64
|
+
"multimodal",
|
|
65
|
+
"ai-video"
|
|
58
66
|
],
|
|
59
67
|
"author": "RunAPI",
|
|
60
68
|
"license": "Apache-2.0",
|
|
@@ -62,5 +70,8 @@
|
|
|
62
70
|
"repository": {
|
|
63
71
|
"type": "git",
|
|
64
72
|
"url": "git+https://github.com/runapi-ai/gemini-omni-sdk.git"
|
|
73
|
+
},
|
|
74
|
+
"bugs": {
|
|
75
|
+
"url": "https://github.com/runapi-ai/gemini-omni-sdk/issues"
|
|
65
76
|
}
|
|
66
77
|
}
|