@tanstack/ai-gemini 0.26.4 → 0.26.5

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/src/model-meta.ts CHANGED
@@ -807,11 +807,44 @@ const VEO_3_1_LITE_PREVIEW = {
807
807
  >
808
808
 
809
809
  /**
810
- * Gemini Omni Flash — multimodal video generation with conversational
811
- * editing. Serves only the Interactions API (`generateContent` rejects it),
812
- * so it routes through the interactions-based path of the video adapter,
813
- * not Veo's `:predictLongRunning` flow. Pricing is per second of generated
814
- * video ($0.10/sec). 720p / 24 FPS, 3–10 second clips (default 10s).
810
+ * Gemini Omni 1.1 Flash — GA. Multimodal video generation with
811
+ * conversational editing. Serves only the Interactions API
812
+ * (`generateContent` rejects it), so it routes through the
813
+ * interactions-based path of the video adapter, not Veo's
814
+ * `:predictLongRunning` flow. Pricing is per second of generated video
815
+ * ($0.10/sec). 360p / 720p (default) / 1080p / 4k at 24 FPS, 3–10 second
816
+ * clips (default 10s).
817
+ * @see https://ai.google.dev/gemini-api/docs/models/gemini-omni-flash
818
+ * @experimental Omni video generation is an experimental feature and may change.
819
+ */
820
+ const GEMINI_OMNI_1_1_FLASH = {
821
+ name: 'gemini-omni-1.1-flash',
822
+ max_input_tokens: 1_048_576,
823
+ max_output_tokens: 1,
824
+ supports: {
825
+ input: ['text', 'image', 'video'],
826
+ output: ['video', 'audio'],
827
+ },
828
+ pricing: {
829
+ input: {
830
+ normal: 0,
831
+ },
832
+ output: {
833
+ normal: 0.1,
834
+ },
835
+ },
836
+ } as const satisfies ModelMeta<
837
+ GeminiToolConfigOptions &
838
+ GeminiSafetyOptions &
839
+ GeminiCommonConfigOptions &
840
+ GeminiCachedContentOptions
841
+ >
842
+
843
+ /**
844
+ * @deprecated `gemini-omni-flash-preview` shuts down on 2026-09-30. Use the
845
+ * GA id `gemini-omni-1.1-flash` instead. Kept in the model union so existing
846
+ * code still compiles until shutdown.
847
+ * @see https://ai.google.dev/gemini-api/docs/models/gemini-omni-flash
815
848
  * @experimental Omni video generation is an experimental feature and may change.
816
849
  */
817
850
  const GEMINI_OMNI_FLASH_PREVIEW = {
@@ -1143,15 +1176,19 @@ export const GEMINI_VIDEO_MODELS = [
1143
1176
  VEO_3_1_PREVIEW.name,
1144
1177
  VEO_3_1_FAST_PREVIEW.name,
1145
1178
  VEO_3_1_LITE_PREVIEW.name,
1179
+ GEMINI_OMNI_1_1_FLASH.name,
1180
+ // Deprecated alias — shuts down 2026-09-30.
1146
1181
  GEMINI_OMNI_FLASH_PREVIEW.name,
1147
1182
  ] as const
1148
1183
 
1149
1184
  /**
1150
1185
  * Video models served by the Interactions API rather than Veo's
1151
- * `:predictLongRunning` operations flow.
1186
+ * `:predictLongRunning` operations flow. GA id first; the trailing
1187
+ * `-preview` id is a shutdown alias kept so existing code compiles.
1152
1188
  * @experimental Omni video generation is an experimental feature and may change.
1153
1189
  */
1154
1190
  export const GEMINI_INTERACTIONS_VIDEO_MODELS = [
1191
+ GEMINI_OMNI_1_1_FLASH.name,
1155
1192
  GEMINI_OMNI_FLASH_PREVIEW.name,
1156
1193
  ] as const
1157
1194
 
@@ -8,7 +8,7 @@ import { convertGoogleSearchRetrievalToolToAdapterFormat } from './google-search
8
8
  import { convertGoogleSearchToolToAdapterFormat } from './google-search-tool'
9
9
  import { convertUrlContextToolToAdapterFormat } from './url-context-tool'
10
10
  import type { Tool } from '@tanstack/ai'
11
- import type { ToolUnion } from '@google/genai'
11
+ import type { FunctionDeclaration, ToolUnion } from '@google/genai'
12
12
 
13
13
  /**
14
14
  * Converts standard Tool format to Gemini-specific tool format
@@ -37,11 +37,7 @@ export function convertToolsToProviderFormat<TTool extends Tool>(
37
37
  }
38
38
  assertUniqueToolNames(tools)
39
39
  const result: Array<ToolUnion> = []
40
- const functionDeclarations: Array<{
41
- name: string
42
- description?: string
43
- parameters?: any
44
- }> = []
40
+ const functionDeclarations: Array<FunctionDeclaration> = []
45
41
 
46
42
  // Process each tool and group function declarations together
47
43
  for (const tool of tools) {
@@ -80,7 +76,7 @@ export function convertToolsToProviderFormat<TTool extends Tool>(
80
76
  functionDeclarations.push({
81
77
  name: tool.name,
82
78
  description: tool.description,
83
- parameters: tool.inputSchema ?? {
79
+ parametersJsonSchema: tool.inputSchema ?? {
84
80
  type: 'object',
85
81
  properties: {},
86
82
  required: [],
@@ -41,15 +41,48 @@ export function isInteractionsVideoModel(
41
41
  }
42
42
 
43
43
  /**
44
- * Supported aspect ratios for Gemini video generation. This is the `size`
45
- * value for the Gemini video adapter — both Veo and Omni Flash express
46
- * output shape as an aspect ratio (plus an optional `resolution` in Veo's
47
- * `modelOptions`), not pixel dimensions.
44
+ * Aspect ratios for Gemini video generation. Veo `size` is this union.
45
+ * Omni `size` also accepts an `aspectRatio_resolution` suffix
46
+ * (`'16:9_1080p'`), same template as grok / byteplus video.
48
47
  *
49
48
  * @experimental Video generation is an experimental feature and may change.
50
49
  */
51
50
  export type GeminiVideoSize = '16:9' | '9:16'
52
51
 
52
+ /**
53
+ * Omni Flash output resolution. Used as the optional suffix on `size`
54
+ * (`'16:9_1080p'`). Default 720p when omitted.
55
+ *
56
+ * @experimental Omni video generation is an experimental feature and may change.
57
+ */
58
+ export type GeminiOmniVideoResolution = '360p' | '720p' | '1080p' | '4k'
59
+
60
+ /**
61
+ * Omni Flash `size`: bare aspect ratio or `aspectRatio_resolution`.
62
+ *
63
+ * @experimental Omni video generation is an experimental feature and may change.
64
+ */
65
+ export type GeminiOmniVideoSize =
66
+ | GeminiVideoSize
67
+ | `${GeminiVideoSize}_${GeminiOmniVideoResolution}`
68
+
69
+ /**
70
+ * Splits an Omni `size` into aspect ratio and optional resolution.
71
+ * `'16:9_1080p'` → `{ aspectRatio: '16:9', resolution: '1080p' }`.
72
+ * `'9:16'` → `{ aspectRatio: '9:16' }`.
73
+ */
74
+ export function parseGeminiOmniVideoSize(
75
+ size: string,
76
+ ): { aspectRatio: string; resolution?: string } | undefined {
77
+ const match = /^(\d+:\d+)(?:_(.+))?$/.exec(size)
78
+ const [, aspectRatio, resolution] = match ?? []
79
+ if (aspectRatio === undefined) return undefined
80
+ return {
81
+ aspectRatio,
82
+ ...(resolution !== undefined && { resolution }),
83
+ }
84
+ }
85
+
53
86
  /**
54
87
  * Provider-specific options for Gemini Veo video generation.
55
88
  *
@@ -85,7 +118,9 @@ export type GeminiVideoProviderOptions = Omit<
85
118
  * and polls it through the `generateVideo` jobs API
86
119
  * - `response_modalities` / `response_format` — the adapter requests video
87
120
  * output and maps the top-level `size` option onto
88
- * `response_format.aspect_ratio`
121
+ * `response_format.aspect_ratio` (and `response_format.resolution` when
122
+ * the size carries a suffix) and `duration` onto
123
+ * `response_format.duration`
89
124
  * - `tools` / `response_mime_type` — not applicable to video generation
90
125
  *
91
126
  * Notable passthroughs:
@@ -121,12 +156,15 @@ export type GeminiVideoModelProviderOptionsByName = {
121
156
  }
122
157
 
123
158
  /**
124
- * Model-specific size (aspect ratio) mapping.
159
+ * Model-specific size mapping. Veo is aspect ratio only. Omni accepts the
160
+ * `aspectRatio_resolution` template (`'16:9_1080p'`).
125
161
  *
126
162
  * @experimental Video generation is an experimental feature and may change.
127
163
  */
128
164
  export type GeminiVideoModelSizeByName = {
129
- [TModel in GeminiVideoModel]: GeminiVideoSize
165
+ [TModel in GeminiVideoModel]: TModel extends GeminiInteractionsVideoModel
166
+ ? GeminiOmniVideoSize
167
+ : GeminiVideoSize
130
168
  }
131
169
 
132
170
  /**
@@ -156,6 +194,7 @@ export type GeminiVideoModelDurationByName = {
156
194
  'veo-3.1-generate-preview': 4 | 6 | 8
157
195
  'veo-3.1-fast-generate-preview': 4 | 6 | 8
158
196
  'veo-3.1-lite-generate-preview': 4 | 6 | 8
197
+ 'gemini-omni-1.1-flash': number
159
198
  'gemini-omni-flash-preview': number
160
199
  }
161
200
 
@@ -182,6 +221,12 @@ export const GEMINI_VIDEO_DURATIONS: {
182
221
  'veo-3.1-generate-preview': { kind: 'discrete', values: [4, 6, 8] },
183
222
  'veo-3.1-fast-generate-preview': { kind: 'discrete', values: [4, 6, 8] },
184
223
  'veo-3.1-lite-generate-preview': { kind: 'discrete', values: [4, 6, 8] },
224
+ 'gemini-omni-1.1-flash': {
225
+ kind: 'range',
226
+ min: 3,
227
+ max: 10,
228
+ unit: 'seconds',
229
+ },
185
230
  'gemini-omni-flash-preview': {
186
231
  kind: 'range',
187
232
  min: 3,