@runapi.ai/gemini-omni 0.3.0 → 0.3.1

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.js CHANGED
@@ -106,6 +106,12 @@ var contract = {
106
106
  "9:16"
107
107
  ]
108
108
  },
109
+ "audio_ids": {
110
+ "max_items": 3
111
+ },
112
+ "character_ids": {
113
+ "max_items": 3
114
+ },
109
115
  "duration_seconds": {
110
116
  "enum": [
111
117
  4,
@@ -126,8 +132,14 @@ var contract = {
126
132
  "prompt": {
127
133
  "required": true
128
134
  },
135
+ "reference_image_urls": {
136
+ "max_items": 7
137
+ },
129
138
  "seed": {
130
139
  "type": "integer"
140
+ },
141
+ "video_list": {
142
+ "max_items": 1
131
143
  }
132
144
  }
133
145
  },
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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-flash-preview\",\n \"gemini-omni-text-to-video\"\n ],\n \"fields_by_model\": {\n \"gemini-omni-flash-preview\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\"\n ]\n },\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\"\n ]\n },\n \"prompt\": {\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\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 \"rules\": [\n {\n \"when\": {\n \"model\": \"gemini-omni-flash-preview\"\n },\n \"forbidden\": [\n \"reference_image_urls\",\n \"audio_ids\",\n \"video_list\",\n \"character_ids\",\n \"duration_seconds\",\n \"seed\"\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\nconst DEFAULT_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, {\n ...body,\n model: body.model ?? DEFAULT_MODEL,\n } 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,uBAAuB;AAAA,UACrB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,6BAA6B;AAAA,QAC3B,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,oBAAoB;AAAA,UAClB,QAAQ;AAAA,QACV;AAAA,QACA,qBAAqB;AAAA,UACnB,QAAQ;AAAA,YACN;AAAA,UACF;AAAA,QACF;AAAA,QACA,UAAU;AAAA,UACR,YAAY;AAAA,QACd;AAAA,QACA,QAAQ;AAAA,UACN,QAAQ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G;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AJvCO,IAAM,mBAAN,cAA+B,wBAAW;AAAA;AAAA,EAE/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,IAAAC,eAUO;","names":["import_core","import_core","ENDPOINT","MODEL","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-flash-preview\",\n \"gemini-omni-text-to-video\"\n ],\n \"fields_by_model\": {\n \"gemini-omni-flash-preview\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\"\n ]\n },\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\"\n ]\n },\n \"prompt\": {\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"gemini-omni-text-to-video\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\"\n ]\n },\n \"audio_ids\": {\n \"max_items\": 3\n },\n \"character_ids\": {\n \"max_items\": 3\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 \"reference_image_urls\": {\n \"max_items\": 7\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"video_list\": {\n \"max_items\": 1\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"gemini-omni-flash-preview\"\n },\n \"forbidden\": [\n \"reference_image_urls\",\n \"audio_ids\",\n \"video_list\",\n \"character_ids\",\n \"duration_seconds\",\n \"seed\"\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\nconst DEFAULT_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, {\n ...body,\n model: body.model ?? DEFAULT_MODEL,\n } 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,uBAAuB;AAAA,UACrB,YAAY;AAAA,QACd;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,UAAU;AAAA,MACR;AAAA,MACA;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB,6BAA6B;AAAA,QAC3B,gBAAgB;AAAA,UACd,QAAQ;AAAA,YACN;AAAA,YACA;AAAA,UACF;AAAA,QACF;AAAA,QACA,oBAAoB;AAAA,UAClB,QAAQ;AAAA,QACV;AAAA,QACA,qBAAqB;AAAA,UACnB,QAAQ;AAAA,YACN;AAAA,UACF;AAAA,QACF;AAAA,QACA,UAAU;AAAA,UACR,YAAY;AAAA,QACd;AAAA,QACA,QAAQ;AAAA,UACN,QA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;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AJvCO,IAAM,mBAAN,cAA+B,wBAAW;AAAA;AAAA,EAE/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,IAAAC,eAUO;","names":["import_core","import_core","ENDPOINT","MODEL","import_core","ENDPOINT","import_core"]}
package/dist/index.mjs CHANGED
@@ -71,6 +71,12 @@ var contract = {
71
71
  "9:16"
72
72
  ]
73
73
  },
74
+ "audio_ids": {
75
+ "max_items": 3
76
+ },
77
+ "character_ids": {
78
+ "max_items": 3
79
+ },
74
80
  "duration_seconds": {
75
81
  "enum": [
76
82
  4,
@@ -91,8 +97,14 @@ var contract = {
91
97
  "prompt": {
92
98
  "required": true
93
99
  },
100
+ "reference_image_urls": {
101
+ "max_items": 7
102
+ },
94
103
  "seed": {
95
104
  "type": "integer"
105
+ },
106
+ "video_list": {
107
+ "max_items": 1
96
108
  }
97
109
  }
98
110
  },
@@ -1 +1 @@
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-flash-preview\",\n \"gemini-omni-text-to-video\"\n ],\n \"fields_by_model\": {\n \"gemini-omni-flash-preview\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\"\n ]\n },\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\"\n ]\n },\n \"prompt\": {\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\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 \"rules\": [\n {\n \"when\": {\n \"model\": \"gemini-omni-flash-preview\"\n },\n \"forbidden\": [\n \"reference_image_urls\",\n \"audio_ids\",\n \"video_list\",\n \"character_ids\",\n \"duration_seconds\",\n \"seed\"\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\nconst DEFAULT_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, {\n ...body,\n model: body.model ?? DEFAULT_MODEL,\n } 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,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AQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,UAAM,OAAOC,eAAc,MAAM;AACjC,IAAAC,gBAAe,SAAS,eAAe,GAAmB;AAAA,MACxD,GAAG;AAAA,MACH,OAAO,KAAK,SAAS;AAAA,IACvB,CAA4B;AAC5B,WAAO,KAAK,KAAK,QAA4B,QAAQF,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AJvCO,IAAM,mBAAN,cAA+B,WAAW;AAAA;AAAA,EAE/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;;;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","compactParams","validateParams"]}
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-flash-preview\",\n \"gemini-omni-text-to-video\"\n ],\n \"fields_by_model\": {\n \"gemini-omni-flash-preview\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\"\n ]\n },\n \"duration_seconds\": {\n \"type\": \"integer\"\n },\n \"output_resolution\": {\n \"enum\": [\n \"720p\"\n ]\n },\n \"prompt\": {\n \"required\": true\n },\n \"seed\": {\n \"type\": \"integer\"\n }\n },\n \"gemini-omni-text-to-video\": {\n \"aspect_ratio\": {\n \"enum\": [\n \"16:9\",\n \"9:16\"\n ]\n },\n \"audio_ids\": {\n \"max_items\": 3\n },\n \"character_ids\": {\n \"max_items\": 3\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 \"reference_image_urls\": {\n \"max_items\": 7\n },\n \"seed\": {\n \"type\": \"integer\"\n },\n \"video_list\": {\n \"max_items\": 1\n }\n }\n },\n \"rules\": [\n {\n \"when\": {\n \"model\": \"gemini-omni-flash-preview\"\n },\n \"forbidden\": [\n \"reference_image_urls\",\n \"audio_ids\",\n \"video_list\",\n \"character_ids\",\n \"duration_seconds\",\n \"seed\"\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\nconst DEFAULT_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, {\n ...body,\n model: body.model ?? DEFAULT_MODEL,\n } 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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I,QAA2B,SAAkF;AACrH,UAAM,EAAE,GAAG,IAAI,MAAM,KAAK,OAAO,QAAQ,OAAO;AAChD,UAAM,WAAW,MAAM,kBAAuC,MAAM,KAAK,IAAI,IAAI,OAAO,GAAG;AAAA,MACzF,WAAW,SAAS;AAAA,MACpB,gBAAgB,SAAS;AAAA,IAC3B,CAAC;AACD,WAAO;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,OAAO,QAA2B,SAAuD;AAC7F,UAAM,OAAOC,eAAc,MAAM;AACjC,IAAAC,gBAAe,SAAS,eAAe,GAAmB;AAAA,MACxD,GAAG;AAAA,MACH,OAAO,KAAK,SAAS;AAAA,IACvB,CAA4B;AAC5B,WAAO,KAAK,KAAK,QAA4B,QAAQF,WAAU;AAAA,MAC7D;AAAA,MACA,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,MAAM,IAAI,IAAY,SAAwD;AAC5E,WAAO,KAAK,KAAK,QAA6B,OAAO,GAAGA,SAAQ,IAAI,EAAE,IAAI;AAAA,MACxE,GAAG;AAAA,IACL,CAAC;AAAA,EACH;AACF;;;AJvCO,IAAM,mBAAN,cAA+B,WAAW;AAAA;AAAA,EAE/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;;;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","compactParams","validateParams"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "runapi": {
4
4
  "slug": "gemini-omni"
5
5
  },
6
- "version": "0.3.0",
6
+ "version": "0.3.1",
7
7
  "description": "RunAPI Gemini Omni SDK for audio, character, and video workflows in JavaScript, Python, Ruby, Go, Java, and PHP",
8
8
  "main": "./dist/index.js",
9
9
  "module": "./dist/index.mjs",
@@ -31,7 +31,7 @@
31
31
  "clean": "rm -rf dist"
32
32
  },
33
33
  "dependencies": {
34
- "@runapi.ai/core": "^0.2.13"
34
+ "@runapi.ai/core": "^0.2.14"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^20.0.0",