Skip to content
Source
Sign inSign up
TanStack/schemas
Open History to see the last commit

release-dates.ts

128 lines4.7 KB

1/**
2 * Release-date sources for providers whose models API carries no timestamp
3 * (issue #1). Two mechanisms, tried in order:
4 *
5 * 1. A curated per-provider map of rawId → 'YYYY-MM-DD' (public announcement
6 * or first-availability date, UTC). Extend freely — unmapped models simply
7 * keep their poll-time firstSeenAt.
8 * 2. For Gemini, a `MM-YYYY` suffix embedded in preview ids
9 * (e.g. `gemini-2.5-computer-use-preview-10-2025`) → first of that month.
10 *
11 * Providers that DO report a date (OpenAI/xAI/OpenRouter `created`,
12 * Anthropic `created_at`, FAL `metadata.date`) parse it in their own
13 * listModels; the shared epoch helpers live here.
14 */
15​
16/** Epoch seconds for a `YYYY-MM-DD` date at UTC midnight. */
17export function dateToEpoch(date: string): number {
18 return Math.floor(Date.parse(`${date}T00:00:00Z`) / 1000)
20​
21/** Epoch seconds from an ISO 8601 timestamp; null when unparseable. */
22export function isoToEpochSeconds(
23 iso: string | undefined | null,
24): number | null {
25 if (!iso) return null
26 const ms = Date.parse(iso)
27 return Number.isNaN(ms) ? null : Math.floor(ms / 1000)
29​
30/**
31 * Gemini preview ids often end in `-MM-YYYY` (announcement month). Returns
32 * the first of that month, or null when the id carries no date.
33 */
34export function geminiIdSuffixDate(rawId: string): number | null {
35 const match = /-(\d{2})-(\d{4})$/.exec(rawId)
36 if (!match) return null
37 const [, month, year] = match
38 const m = Number(month)
39 if (m < 1 || m > 12) return null
40 return dateToEpoch(`${year}-${month}-01`)
42​
43/**
44 * BytePlus dated ids end in `-YYMMDD` (e.g. `seedance-1-5-pro-251215` →
45 * 2025-12-15) — the release stamp BytePlus itself versions models by.
46 * Returns null for undated ids (`seed-audio-1.0`, `seed-asr`) or an
47 * implausible month/day.
48 */
49export function byteplusIdSuffixDate(rawId: string): number | null {
50 const match = /-(\d{2})(\d{2})(\d{2})$/.exec(rawId)
51 if (!match) return null
52 const [, year, month, day] = match
53 const m = Number(month)
54 const d = Number(day)
55 if (m < 1 || m > 12 || d < 1 || d > 31) return null
56 return dateToEpoch(`20${year}-${month}-${day}`)
58​
59/**
60 * First public availability (preview counts), from ai.google.dev changelog
61 * and Google announcement posts. Rolling `-latest` aliases and models with
62 * no confirmable date are deliberately unmapped. Ids carrying a `-MM-YYYY`
63 * suffix (computer-use, deep-research, native-audio previews, …) resolve
64 * via geminiIdSuffixDate and need no entry here.
65 */
66export const GEMINI_RELEASE_DATES: Record<string, string> = {
67 'gemini-2.0-flash': '2024-12-11',
68 'gemini-2.0-flash-001': '2025-02-05',
69 'gemini-2.0-flash-lite': '2025-02-05',
70 'gemini-2.0-flash-lite-001': '2025-02-25',
71 'gemini-2.5-pro': '2025-03-25',
72 'gemini-2.5-flash': '2025-04-17',
73 'gemini-2.5-flash-lite': '2025-07-22',
74 'gemini-2.5-flash-image': '2025-08-26',
75 'gemini-2.5-flash-preview-tts': '2025-05-20',
76 'gemini-2.5-pro-preview-tts': '2025-05-20',
77 'gemini-3-pro-preview': '2025-11-18',
78 'gemini-3-flash-preview': '2025-12-17',
79 'gemini-3-pro-image': '2025-11-20',
80 'gemini-3-pro-image-preview': '2025-11-20',
81 'nano-banana-pro-preview': '2025-11-20',
82 'gemini-3.1-pro-preview': '2026-02-19',
83 'gemini-3.1-pro-preview-customtools': '2026-02-19',
84 'gemini-3.1-flash-lite-preview': '2026-03-03',
85 'gemini-3.1-flash-lite': '2026-05-07',
86 'gemini-3.1-flash-image': '2026-05-28',
87 'gemini-3.1-flash-image-preview': '2026-05-28',
88 'gemini-3.5-flash': '2026-05-19',
89 'gemini-omni-flash-preview': '2026-06-30',
90 'gemini-embedding-001': '2025-07-14',
91 'gemini-embedding-2': '2026-04-22',
92 'gemini-embedding-2-preview': '2026-04-22',
93 'gemma-4-26b-a4b-it': '2026-04-02',
94 'gemma-4-31b-it': '2026-04-02',
95 'lyria-3-pro-preview': '2026-03-25',
96 'veo-3.1-generate-preview': '2025-10-15',
97 'veo-3.1-fast-generate-preview': '2025-10-15',
98 'gemini-robotics-er-1.5-preview': '2025-09-25',
99 'gemini-robotics-er-1.6-preview': '2026-04-14',
100 'imagen-4.0-generate-001': '2025-08-14',
101 'imagen-4.0-ultra-generate-001': '2025-08-14',
102 'imagen-4.0-fast-generate-001': '2025-08-14',
104​
105/**
106 * From ElevenLabs' own blog posts (public alpha/launch dates). The v1
107 * multilingual and speech-to-speech models have no official dated posts
108 * and stay unmapped.
109 */
110export const ELEVENLABS_RELEASE_DATES: Record<string, string> = {
111 eleven_monolingual_v1: '2023-01-23',
112 eleven_multilingual_v2: '2023-08-22',
113 eleven_turbo_v2: '2023-11-09',
114 eleven_turbo_v2_5: '2024-07-19',
115 eleven_flash_v2: '2024-12-01',
116 eleven_flash_v2_5: '2024-12-01',
117 eleven_v3: '2025-06-05',
119​
120/** Curated lookup + (Gemini) id-suffix fallback. */
121export function curatedReleasedAt(
122 map: Record<string, string>,
123 rawId: string,
124): number | null {
125 const date = map[rawId]
126 if (date) return dateToEpoch(date)
127 return null