diff --git a/src/server/providers/fixtures/openai-gpt-live-1.1.md.txt b/src/server/providers/fixtures/openai-gpt-live-1.1.md.txt new file mode 100644 index 00000000..2d983053 --- /dev/null +++ b/src/server/providers/fixtures/openai-gpt-live-1.1.md.txt @@ -0,0 +1,70 @@ +# GPT-Live-1.1 + +> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL. + +> Full-duplex voice model for multilingual conversations. + +Model ID: `gpt-live-1.1` + +GPT-Live-1.1 can listen while it speaks. Compared with GPT-Live-1, it transcribes speech more accurately and maintains a more consistent accent and voice across languages. Describe in plain language when the model should hand a task to your backend for reasoning or tool use. + +Learn how to [start a voice session](/api/docs/guides/live), [prompt GPT-Live](/api/docs/guides/live-prompting), and [configure delegation](/api/docs/guides/live-delegation). + +## Model details + +- Default snapshot: `gpt-live-1.1` +- Input modalities: audio, text +- Output modalities: audio, text + +## Pricing + +Voice sessions are billed by duration. Backend model and tool usage is billed separately. + +### Live session duration + +| Metric | Price | Unit | +| --- | ---: | --- | +| Active | $0.05 | minute | +| Standby | $0.02 | minute | + +- The lower standby rate applies to WebRTC sessions while inference is paused. See [GPT-Live pricing](/api/docs/pricing#live-session-duration). + +## Endpoints + +| Endpoint | Route | Support | +| --- | --- | --- | +| Live | `v1/live/sessions` | Supported | +| Chat Completions | `v1/chat/completions` | Not supported | +| Responses | `v1/responses` | Not supported | +| Realtime | `v1/realtime` | Not supported | +| Realtime translation | `v1/realtime/translations` | Not supported | +| Realtime transcription | `v1/realtime/transcription_sessions` | Not supported | +| Assistants | `v1/assistants` | Not supported | +| Batch | `v1/batch` | Not supported | +| Fine-tuning | `v1/fine-tuning` | Not supported | +| Embeddings | `v1/embeddings` | Not supported | +| Image generation | `v1/images/generations` | Not supported | +| Videos | `v1/videos` | Not supported | +| Image edit | `v1/images/edits` | Not supported | +| Speech generation | `v1/audio/speech` | Not supported | +| Transcription | `v1/audio/transcriptions` | Not supported | +| Translation | `v1/audio/translations` | Not supported | +| Moderation | `v1/moderations` | Not supported | +| Completions (legacy) | `v1/completions` | Not supported | + +## Supported features + +- streaming +- function_calling + +## Snapshots + +Use `gpt-live-1.1` in your API requests. + +- `gpt-live-1.1` + +## Rate limits + +GPT-Live-1.1 and GPT-Live-1 have separate concurrent-session limits. Each model’s limit applies across inference regions. + +See your [organization’s limits](https://platform.openai.com/settings/organization/limits) for the rate limits that apply to your account. diff --git a/src/server/providers/fixtures/openai-gpt-live-1.md.txt b/src/server/providers/fixtures/openai-gpt-live-1.md.txt new file mode 100644 index 00000000..693992c3 --- /dev/null +++ b/src/server/providers/fixtures/openai-gpt-live-1.md.txt @@ -0,0 +1,88 @@ +# GPT-Live-1 + +> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL. + +> Our premier model for natural, expressive voice conversations with smooth interruption handling. + +Model ID: `gpt-live-1` + +GPT-Live-1 is a full-duplex voice model for real-time conversations. It can listen and speak at the same time, and delegate reasoning and tool use to a backend agent. + +Learn how to [get started with GPT-Live](/api/docs/guides/live), [configure delegation](/api/docs/guides/live-delegation), and [prompt the model](/api/docs/guides/live-prompting). + +## Model details + +- Default snapshot: `gpt-live-1` +- Input modalities: audio, text +- Output modalities: audio, text +- Unsupported modalities: image, video +- Jul 31, 2025 knowledge cutoff + +## Pricing + +Voice sessions are billed per second. Backend model and tool usage is billed separately. + +### Live session duration + +| Metric | Price | Unit | +| --- | ---: | --- | +| Active | $0.05 | minute | +| Standby | $0.02 | minute | + +- The lower standby rate applies to WebRTC sessions while inference is paused. See [GPT-Live pricing](/api/docs/pricing#live-session-duration). +- Session duration is not rounded up to the next whole minute. +- Backend Responses calls use the normal pricing for the configured model and tools. + +## Endpoints + +| Endpoint | Route | Support | +| --- | --- | --- | +| Live | `v1/live/sessions` | Supported | +| Chat Completions | `v1/chat/completions` | Not supported | +| Responses | `v1/responses` | Not supported | +| Realtime | `v1/realtime` | Not supported | +| Realtime translation | `v1/realtime/translations` | Not supported | +| Realtime transcription | `v1/realtime/transcription_sessions` | Not supported | +| Assistants | `v1/assistants` | Not supported | +| Batch | `v1/batch` | Not supported | +| Fine-tuning | `v1/fine-tuning` | Not supported | +| Embeddings | `v1/embeddings` | Not supported | +| Image generation | `v1/images/generations` | Not supported | +| Videos | `v1/videos` | Not supported | +| Image edit | `v1/images/edits` | Not supported | +| Speech generation | `v1/audio/speech` | Not supported | +| Transcription | `v1/audio/transcriptions` | Not supported | +| Translation | `v1/audio/translations` | Not supported | +| Moderation | `v1/moderations` | Not supported | +| Completions (legacy) | `v1/completions` | Not supported | + +## Supported features + +- streaming +- function_calling + +## Unsupported features + +- structured_outputs +- fine_tuning +- predicted_outputs + +## Snapshots + +Use `gpt-live-1` in your API requests. + +- `gpt-live-1` + +## Rate limits + +Rate limits are measured in concurrent sessions. + +Unsupported usage tiers: Free. + +### Concurrent sessions + +| Tier | Concurrent sessions | +| --- | ---: | +| Build | 50 | +| Launch | 300 | +| Grow | 500 | diff --git a/src/server/providers/model-facts.test.ts b/src/server/providers/model-facts.test.ts index c6efe079..de880096 100644 --- a/src/server/providers/model-facts.test.ts +++ b/src/server/providers/model-facts.test.ts @@ -1,3 +1,4 @@ +import { readFileSync } from 'node:fs' import { describe, expect, it, vi } from 'vitest' import { anthropicCapabilities } from './anthropic.ts' @@ -35,9 +36,10 @@ import { } from './model-facts.ts' import { price } from '@modelschemas/rate-card' import { evaluateCard } from '@modelschemas/rate-card/evaluator' -import { parseStoredRateCard } from '../rate-card.ts' +import { parseStoredRateCard, projectTokenPricing } from '../rate-card.ts' import { openAiCompatModelFacts } from './openai-compat.ts' import { + compileLiveSessionCard, pageSlugFor, parseModelIndex, parseModelPage, @@ -855,6 +857,82 @@ Landscape: 1920x1080 | $0.7 | second | }) }) + it('prices active and standby seconds from both gpt-live pages', () => { + const source = { + url: 'https://developers.openai.com/api/docs/models/gpt-live-1.md', + hash: 'a'.repeat(64), + extractedAt: '2026-11-20T00:00:00.000Z', + } + for (const file of [ + 'openai-gpt-live-1.md.txt', + 'openai-gpt-live-1.1.md.txt', + ]) { + const page = parseModelPage( + readFileSync(new URL(`./fixtures/${file}`, import.meta.url), 'utf8'), + ) + expect(page?.pricing?.session).toEqual({ + activeSeconds: 0.05 / 60, + standbySeconds: 0.02 / 60, + }) + expect(page?.pricing?.unit).toBeUndefined() + const card = page?.pricing?.session + ? compileLiveSessionCard(page.pricing.session, source) + : null + if (!card) throw new Error(`${file}: did not compile`) + expect(parseStoredRateCard(card)).toEqual(card) + expect(projectTokenPricing(card)).toEqual({ + currency: 'USD', + per: 'second', + }) + // A minute is not rounded up: 30s is half the per-minute rate. + expect( + price(card, {}, { active_seconds: 60, standby_seconds: 0 }), + ).toBeCloseTo(0.05, 9) + expect( + price(card, {}, { active_seconds: 0, standby_seconds: 60 }), + ).toBeCloseTo(0.02, 9) + expect( + price(card, {}, { active_seconds: 30, standby_seconds: 30 }), + ).toBeCloseTo(0.035, 9) + expect(() => price(card, {}, { active_seconds: 60 })).toThrow( + expect.objectContaining({ code: 'bad-input' }), + ) + } + }) + + it('refuses a live table that drops either rate or names another metric', () => { + const live = (rows: string) => + parseModelPricing( + pricing(`### Live session duration + +| Metric | Price | Unit | +| --- | ---: | --- | +${rows} +`), + ) + expect( + live(`| Active | $0.05 | minute | +| Standby | $0.02 | minute |`), + ).toMatchObject({ + session: { activeSeconds: 0.05 / 60, standbySeconds: 0.02 / 60 }, + }) + expect(live('| Active | $0.05 | minute |')).toBeNull() + expect(live('| Standby | $0.02 | minute |')).toBeNull() + expect( + live(`| Active | $0.05 | minute | +| Listening | $0.02 | minute |`), + ).toBeNull() + expect( + live(`| Active | $0.05 | minute | +| Standby | $0.02 | minute | +| Extra | $0.01 | minute |`), + ).toBeNull() + expect( + live(`| First | $0.05 | minute | +| Second | $0.02 | minute |`), + ).toBeNull() + }) + it('refuses a page that mixes a token table with a per-unit one', () => { expect( parseModelPricing( diff --git a/src/server/providers/openai-model-docs.ts b/src/server/providers/openai-model-docs.ts index 5794945d..bd6cd507 100644 --- a/src/server/providers/openai-model-docs.ts +++ b/src/server/providers/openai-model-docs.ts @@ -13,7 +13,11 @@ import { * ~130 listed ids share a page), bounded-concurrency, memoised six hours. */ import { compileTokenCard, compileUnitCard } from '@modelschemas/rate-card' -import type { TokenRateTier, UnitCardSpec } from '@modelschemas/rate-card' +import type { + RateCard, + TokenRateTier, + UnitCardSpec, +} from '@modelschemas/rate-card' import { tagDocsFacts } from './fact-sources.ts' import { @@ -158,6 +162,12 @@ export interface DocsPricing { expiresAt?: string /** Set instead of `rates` when the model is billed per unit. */ unit?: UnitCardSpec + /** + * Active and standby session seconds, each USD per second. Set instead + * of `unit` when a live page states both rates. Neither rate alone is + * this card. + */ + session?: { activeSeconds: number; standbySeconds: number } /** A Cached input cell was "-" or blank. Not a rate. */ cacheReadNotOffered?: true } @@ -170,13 +180,26 @@ const UNITS: Record = { } /** - * A per-unit section: one rate, or one per output size. The metric cell of - * a video row names the sizes the rate covers ("Portrait: 720x1280 - * Landscape: 1280x720"), which are `size` values on the request. + * Metric names on a live-session table that are each their own usage + * quantity. Any other unsized name in a multi-row table refuses the model. + */ +const LIVE_SESSION_METRICS = ['Active', 'Standby'] as const + +type ParsedUnit = + | { spec: UnitCardSpec } + | { session: { activeSeconds: number; standbySeconds: number } } + +/** + * A per-unit section: one rate, one per output size, or active and standby + * session time. The metric cell of a video row names the sizes the rate + * covers ("Portrait: 720x1280 Landscape: 1280x720"), which are `size` + * values on the request. Several unsized rows are a live session only when + * they are exactly Active and Standby; one of those names without the + * other refuses, and so does any other pair. */ -function parseUnitSection(block: string): UnitCardSpec | null { +function parseUnitSection(block: string): ParsedUnit | null { const rates: Record = {} - let flat: number | null = null + const flats: Array<{ metric: string; perSecond: number }> = [] let unit: { param: string; per: number } | undefined for (const [metric = '', price, cell] of markdownTableRows(block)) { if (metric === 'Metric') continue @@ -195,25 +218,95 @@ function parseUnitSection(block: string): UnitCardSpec | null { ([size]) => size, ) if (sizes.length === 0) { - if (flat !== null) return null - flat = rate / found.per + flats.push({ metric, perSecond: rate / found.per }) continue } for (const size of sizes) rates[size] = rate / found.per } if (!unit) return null const sized = Object.keys(rates).length > 0 - if (sized && flat !== null) return null - if (!sized && flat === null) return null + if (sized && flats.length > 0) return null // Duration and characters are measured after the call; a video's length // and size are fields of the request that asked for it. const bound = unit.param === 'seconds' ? 'request' : 'usage' + if (sized) { + return { + spec: { + quantity: { param: unit.param, bound }, + keys: [{ param: 'size', values: Object.keys(rates) }], + rates, + }, + } + } + const only = flats[0] + if (flats.length === 1 && only) { + // Active or Standby alone is half a live card, not the old single rate. + if ( + only.metric === 'Active' || + only.metric === 'Standby' || + !(only.perSecond > 0) + ) { + return null + } + return { + spec: { + quantity: { param: unit.param, bound }, + rates: only.perSecond, + }, + } + } + if ( + flats.length !== 2 || + (unit.param !== 'audio_seconds' && unit.param !== 'seconds') + ) { + return null + } + const byMetric = new Map(flats.map((row) => [row.metric, row.perSecond])) + const active = byMetric.get('Active') + const standby = byMetric.get('Standby') + if ( + byMetric.size !== LIVE_SESSION_METRICS.length || + active === undefined || + standby === undefined || + !(active > 0) || + !(standby > 0) + ) { + return null + } + return { session: { activeSeconds: active, standbySeconds: standby } } +} + +/** + * Active and standby session seconds, summed. Each lever is the duration + * the caller measured; neither defaults, so an omitted one is not billed + * as zero. Rates are USD per second. + */ +export function compileLiveSessionCard( + rates: { activeSeconds: number; standbySeconds: number }, + source: RateCard['source'], +): RateCard | null { + const { activeSeconds, standbySeconds } = rates + if (!(activeSeconds > 0) || !(standbySeconds > 0)) return null + const lever = (param: 'active_seconds' | 'standby_seconds') => + ({ + param, + bound: 'usage' as const, + kind: 'number' as const, + }) satisfies RateCard['inputs'][string] return { - quantity: { param: unit.param, bound }, - ...(sized && { - keys: [{ param: 'size', values: Object.keys(rates) }], - }), - rates: sized ? rates : (flat ?? 0), + inputs: { + active_seconds: lever('active_seconds'), + standby_seconds: lever('standby_seconds'), + }, + tables: {}, + price: { + '+': [ + { '*': [{ var: 'active_seconds' }, activeSeconds] }, + { '*': [{ var: 'standby_seconds' }, standbySeconds] }, + ], + }, + examples: [], + source, } } @@ -287,8 +380,11 @@ export function parseModelPricing(markdown: string): DocsPricing | null { // A model is billed one way: a page mixing token tables with a // per-unit one is a shape this parser does not know. if (blocks.length !== 1) return null - const unit = parseUnitSection(block) - return unit ? { rates: {}, tiers: [], unit } : null + const parsed = parseUnitSection(block) + if (!parsed) return null + return 'session' in parsed + ? { rates: {}, tiers: [], session: parsed.session } + : { rates: {}, tiers: [], unit: parsed.spec } } const levers = PRICING_LEVERS[heading] if (!levers) return null @@ -710,26 +806,32 @@ export async function openaiModelFacts( const url = OPENAI_MODEL_PAGE(loaded.slug) const withPricing: ModelFacts = { ...loaded.page.facts, - pricing: loaded.page.pricing?.unit - ? compileUnitCard(loaded.page.pricing.unit, { + pricing: loaded.page.pricing?.session + ? compileLiveSessionCard(loaded.page.pricing.session, { url, hash: loaded.page.hash, extractedAt: loaded.page.extractedAt, }) - : loaded.page.pricing - ? compileTokenCard( - loaded.page.pricing.rates, - loaded.page.pricing.tiers, - { - url, - hash: loaded.page.hash, - extractedAt: loaded.page.extractedAt, - ...(loaded.page.pricing.expiresAt && { - expiresAt: loaded.page.pricing.expiresAt, - }), - }, - ) - : null, + : loaded.page.pricing?.unit + ? compileUnitCard(loaded.page.pricing.unit, { + url, + hash: loaded.page.hash, + extractedAt: loaded.page.extractedAt, + }) + : loaded.page.pricing + ? compileTokenCard( + loaded.page.pricing.rates, + loaded.page.pricing.tiers, + { + url, + hash: loaded.page.hash, + extractedAt: loaded.page.extractedAt, + ...(loaded.page.pricing.expiresAt && { + expiresAt: loaded.page.pricing.expiresAt, + }), + }, + ) + : null, } const facts: ModelFacts = { ...withPricing, diff --git a/src/server/rate-card.ts b/src/server/rate-card.ts index 9ef310d5..54ee8d97 100644 --- a/src/server/rate-card.ts +++ b/src/server/rate-card.ts @@ -256,6 +256,8 @@ function perMillion( const UNIT_OF_LEVER: Record = { seconds: 'second', audio_seconds: 'second', + active_seconds: 'second', + standby_seconds: 'second', original_duration: 'second', session_seconds: 'second', video_seconds: 'second',