From 606857631397e1bc66a8776d4bd91bc90cc96b4a Mon Sep 17 00:00:00 2001 From: Tom Beckenham <34339192+tombeckenham@users.noreply.github.com> Date: Fri, 27 Nov 2026 19:26:09 +1100 Subject: [PATCH] Read Mistral's model catalog from the docs HTML payload (#771) docs.mistral.ai/models.md now redirects to a section index. The overview, deprecations and model pages live in the page's catalog record. The reasoning and web-search guides are the llms.txt documents again. --- README.md | 2 +- docs/native-reasoning-sources.md | 9 +- src/server/providers/adapters/mistral.test.ts | 2 - src/server/providers/adapters/mistral.ts | 2 +- src/server/providers/deprecations.test.ts | 118 ++++++ src/server/providers/deprecations.ts | 74 +++- src/server/providers/mistral-catalog.ts | 328 ++++++++++++++++ src/server/providers/mistral-pricing.test.ts | 355 +++++++++++++++++- src/server/providers/mistral-pricing.ts | 267 +++++++++++-- src/server/providers/model-facts.ts | 4 +- src/server/providers/reasoning-config.ts | 11 +- 11 files changed, 1103 insertions(+), 69 deletions(-) create mode 100644 src/server/providers/mistral-catalog.ts diff --git a/README.md b/README.md index 921728ca..fa2d293a 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ It is never read from an id's shape. `GET /openai/v1/models`; BytePlus the Provider column of the [model list](https://docs.byteplus.com/en/docs/ModelArk/1330310); Mistral an overview Summary that opens "A third-party ... model from - Z.ai" ([models.md](https://docs.mistral.ai/models.md)), copied onto the + Z.ai" ([models](https://docs.mistral.ai/models)), copied onto the listing's alias group; Gemini the Authors line of the [Gemma 4 card](https://ai.google.dev/gemma/docs/core/model_card_4), which also fills `openWeights` and `weightsUrl` for the sizes it binds. Never diff --git a/docs/native-reasoning-sources.md b/docs/native-reasoning-sources.md index a7a0063c..a26ea188 100644 --- a/docs/native-reasoning-sources.md +++ b/docs/native-reasoning-sources.md @@ -100,11 +100,12 @@ source URL, fixture or output; they make no inference calls. ## Mistral -https://docs.mistral.ai/inference/conversations/reasoning +https://docs.mistral.ai/llms/inference/conversations/reasoning/llms.txt -Checked 2026-11-19. `llms.txt` links the `.md` twin of this page, and the old -`/studio/conversations/reasoning.md` path redirects to that twin, but the twin -404s. The HTML page is the guide. +Checked 2026-11-27. The HTML page at +`/inference/conversations/reasoning` no longer keeps the `reasoning_effort` +bullets once it is converted to text. `/inference/conversations/reasoning.md` +redirects to this `llms.txt` document, which is the guide. The guide scopes adjustable reasoning to named model IDs, followed by a normative parameter-value section describing high and none. These values apply to that diff --git a/src/server/providers/adapters/mistral.test.ts b/src/server/providers/adapters/mistral.test.ts index f4eedbb9..cf1308cc 100644 --- a/src/server/providers/adapters/mistral.test.ts +++ b/src/server/providers/adapters/mistral.test.ts @@ -173,8 +173,6 @@ describe('mistral listModels modalities', () => { [MISTRAL_REASONING_URL]: '- `mistral-small-latest`: Supports adjustable reasoning via the `reasoning_effort` parameter.', 'https://docs.mistral.ai/models': - 'x', - 'https://docs.mistral.ai/models.md': '| [Nope](/models/not-a-listed-id) | `not-a-listed-id` | GA |', 'https://docs.mistral.ai/openapi.yaml': `components: schemas: diff --git a/src/server/providers/adapters/mistral.ts b/src/server/providers/adapters/mistral.ts index 938ebc9f..fcd9f33e 100644 --- a/src/server/providers/adapters/mistral.ts +++ b/src/server/providers/adapters/mistral.ts @@ -191,7 +191,7 @@ export const provider: ProviderConfig = { ) if (names && names.length > 0) aliases.set(row.id, names) // `created` is the request time on every row, not a release date - // (#708). The date comes from the model page's markdown twin. + // (#708). The date comes from the model page's catalog record. return Promise.resolve({ releasedAt: null, ...mistralAliasFacts(row) }) }, }) diff --git a/src/server/providers/deprecations.test.ts b/src/server/providers/deprecations.test.ts index 34de36ba..17dc6792 100644 --- a/src/server/providers/deprecations.test.ts +++ b/src/server/providers/deprecations.test.ts @@ -148,3 +148,121 @@ describe('mistral deprecations table', () => { ).toThrow(/no API name/) }) }) + +function catalogHtml(models: Array): string { + const stream = `1:${JSON.stringify(models)}\n` + return `` +} + +function catalogRow(overrides: Record = {}) { + return { + slug: 'pixtral-12b-24-09', + status: 'deprecated', + modelIds: ['pixtral-12b-2409'], + shortDescription: 'Vision model.', + deprecatedAt: '2025-12-02T00:00:00.000Z', + retiredAt: '2025-12-31T00:00:00.000Z', + replacedBy: { modelIds: ['ministral-14b-2512'] }, + inputs: ['text', 'image'], + outputs: ['text'], + features: [], + maxOutputTokens: null, + releasedAt: '2024-09-17T00:00:00.000Z', + pricing: [], + isFree: false, + ...overrides, + } +} + +describe('mistral deprecations catalog', () => { + it('reads one entry per API id, with the successor primary id', () => { + const rows = new Map( + parseMistralDeprecations( + catalogHtml([ + catalogRow(), + catalogRow({ + slug: 'mistral-medium-3-5-26-04', + modelIds: ['mistral-medium-3-5', 'mistral-medium-latest'], + deprecatedAt: '2026-10-31T00:00:00.000Z', + retiredAt: '2027-04-30T00:00:00.000Z', + replacedBy: { + modelIds: ['mistral-large-4', 'mistral-large-4-0'], + }, + }), + catalogRow({ + slug: 'leanstral-1-5', + modelIds: ['labs-leanstral-1-5'], + replacedBy: null, + }), + catalogRow({ + slug: 'voxtral-mini-25-07', + status: 'retired', + modelIds: [], + }), + catalogRow({ + slug: 'mistral-small-4', + status: 'ga', + modelIds: ['mistral-small-2603'], + }), + ]), + ).map((row) => [row.rawId, row]), + ) + expect(rows.get('pixtral-12b-2409')).toEqual({ + rawId: 'pixtral-12b-2409', + deprecatedAt: day('2025-12-02'), + retiresAt: day('2025-12-31'), + replacedBy: ['ministral-14b-2512'], + sourceUrl: MISTRAL_DEPRECATIONS_URL, + }) + expect(rows.get('mistral-medium-latest')?.replacedBy).toEqual([ + 'mistral-large-4', + ]) + expect(rows.get('labs-leanstral-1-5')?.replacedBy).toBeNull() + expect(rows.has('mistral-small-2603')).toBe(false) + expect([...rows.keys()].some((id) => id === '')).toBe(false) + }) + + it('throws when the payload has no deprecated rows, or a replacement names no API id', () => { + expect(() => + parseMistralDeprecations( + catalogHtml([ + catalogRow({ status: 'ga', modelIds: ['mistral-large-4'] }), + ]), + ), + ).toThrow(/parsed 0 model rows/) + expect(() => + parseMistralDeprecations( + '', + ), + ).toThrow(/parsed 0 model rows/) + expect(() => + parseMistralDeprecations( + catalogHtml([catalogRow({ replacedBy: { modelIds: [] } })]), + ), + ).toThrow(/no API name/) + expect(() => + parseMistralDeprecations(catalogHtml([catalogRow({ replacedBy: 100 })])), + ).toThrow(/no API name/) + const populated = catalogRow() + expect( + parseMistralDeprecations( + catalogHtml([catalogRow({ replacedBy: 100 }), populated]), + ).find((row) => row.rawId === 'pixtral-12b-2409')?.replacedBy, + ).toEqual(['ministral-14b-2512']) + expect(() => + parseMistralDeprecations( + catalogHtml([ + catalogRow({ + modelIds: ['same-id'], + retiredAt: '2025-12-31T00:00:00.000Z', + }), + catalogRow({ + slug: 'other', + modelIds: ['same-id'], + retiredAt: '2026-01-01T00:00:00.000Z', + }), + ]), + ), + ).toThrow(/listed twice/) + }) +}) diff --git a/src/server/providers/deprecations.ts b/src/server/providers/deprecations.ts index 77a350fa..1b99e285 100644 --- a/src/server/providers/deprecations.ts +++ b/src/server/providers/deprecations.ts @@ -4,6 +4,11 @@ * read off the page as written; a cell the parser cannot read throws, so a * reshaped page fails the source (`tryDocs`) instead of writing guesses. */ +import type { MistralCatalogModel } from './mistral-catalog.ts' +import { + mistralCatalogInstant, + parseMistralCatalog, +} from './mistral-catalog.ts' import type { DocsRun } from './model-facts.ts' import { tryDocs } from './model-facts.ts' import { fetchText } from './types.ts' @@ -11,7 +16,12 @@ import type { ModelDeprecation } from './types.ts' export const GROQ_DEPRECATIONS_URL = 'https://console.groq.com/docs/deprecations.md' -export const MISTRAL_DEPRECATIONS_URL = 'https://docs.mistral.ai/models.md' +/** + * The models overview. `/models.md` redirects to a section index with no + * table (checked 2026-11-27). The HTML page's catalog holds current and + * deprecated rows. + */ +export const MISTRAL_DEPRECATIONS_URL = 'https://docs.mistral.ai/models' const MONTHS = [ 'january', @@ -173,16 +183,66 @@ const LINKED = /^\[[^\]]+\]\((\/models\/[a-z0-9-]+)\)$/ const API_NAME = /^`([^`]+)`$/ /** - * Mistral's Models Overview: the "Deprecated and retired models" table, - * Model | API name | Status | Context | Summary | Deprecation | Retirement - * | Replacement. The replacement is a link to a model page; its API name is - * the one the same page's tables give that link; a link no table names - * throws. Rows with no API name name no callable id and are skipped. An - * API name listed twice keeps its first (newest) row. + * Deprecated and retired catalog rows. Each API id on the row is one + * entry. The replacement is the successor's primary API id (the first + * `modelIds` entry). A row with no API id names nothing callable and is + * skipped. The same id from two rows keeps the first only when the facts + * agree; a disagreement throws. + */ +function deprecationsFromCatalog( + models: Array, +): Array { + const source = 'mistral deprecations' + const out = new Map() + for (const model of models) { + if (model.status !== 'deprecated' && model.status !== 'retired') continue + if (model.modelIds.length === 0) continue + const replacedBy = model.replacementIds?.[0] + ? [model.replacementIds[0]] + : null + const entry = { + deprecatedAt: mistralCatalogInstant(model.deprecatedAt, source), + retiresAt: mistralCatalogInstant(model.retiredAt, source), + replacedBy, + sourceUrl: MISTRAL_DEPRECATIONS_URL, + } + for (const rawId of model.modelIds) { + requireId(rawId, source) + const prior = out.get(rawId) + if (!prior) { + out.set(rawId, { rawId, ...entry }) + continue + } + if ( + prior.deprecatedAt !== entry.deprecatedAt || + prior.retiresAt !== entry.retiresAt || + JSON.stringify(prior.replacedBy) !== JSON.stringify(entry.replacedBy) + ) { + throw new Error(`${source}: ${rawId} is listed twice`) + } + } + } + if (out.size === 0) throw new Error(`${source}: parsed 0 model rows`) + return [...out.values()] +} + +/** + * Mistral's models overview. The HTML catalog is the live page. The + * markdown table remains for the pre-2026-11-25 shape: "Deprecated and + * retired models", Model | API name | Status | Context | Summary | + * Deprecation | Retirement | Replacement. The replacement is a link to a + * model page; its API name is the one the same page's tables give that + * link; a link no table names throws. Rows with no API name are skipped. + * An API name listed twice keeps its first row. */ export function parseMistralDeprecations( markdown: string, ): Array { + const catalog = parseMistralCatalog(markdown) + if (catalog.length > 0) return deprecationsFromCatalog(catalog) + if (markdown.includes('__next_f')) { + throw new Error('mistral deprecations: parsed 0 model rows') + } const source = 'mistral deprecations' const [current, retired] = markdown.split( /^## Deprecated and retired models$/m, diff --git a/src/server/providers/mistral-catalog.ts b/src/server/providers/mistral-catalog.ts new file mode 100644 index 00000000..ae29196a --- /dev/null +++ b/src/server/providers/mistral-catalog.ts @@ -0,0 +1,328 @@ +/** + * The models overview and each model page embed the same catalog record + * (issue #771). `docs.mistral.ai/models.md` now redirects to a section + * index with no table, and the HTML page no longer renders the old + * Model | API name markdown. Records are read from the RSC payload. + * A record that is present but unreadable throws. A page with no catalog + * record is an empty list, so the older tooltip and markdown parsers + * still run on fixtures. + */ +const MODEL_ID = /^[a-z0-9][a-z0-9._/-]*$/ +const SLUG = /^[a-z0-9-]+$/ +const STATUSES = new Set(['ga', 'publicPreview', 'deprecated', 'retired']) + +export interface MistralCatalogPrice { + direction: 'input' | 'output' + label: string + /** Null when the unit is written inside the label, `Input (/M tokens)`. */ + unit: string | null + priceUsd: number +} + +export interface MistralCatalogModel { + slug: string + status: 'ga' | 'publicPreview' | 'deprecated' | 'retired' + /** Callable API ids. Empty when the row is a family page, not a model. */ + modelIds: Array + shortDescription: string + deprecatedAt: string | null + retiredAt: string | null + /** API ids of the replacement, primary first. Null when the page names none. */ + replacementIds: Array | null + inputs: Array + outputs: Array + features: Array + maxOutputTokens: number | null + releasedAt: string | null + pricing: Array + isFree: boolean +} + +const REQUIRED = [ + 'slug', + 'status', + 'modelIds', + 'shortDescription', + 'deprecatedAt', + 'retiredAt', + 'replacedBy', + 'inputs', + 'outputs', + 'features', + 'maxOutputTokens', + 'releasedAt', + 'pricing', + 'isFree', +] as const + +type Json = + | null + | string + | number + | boolean + | Array + | { [key: string]: Json } + +function isRecord(value: unknown): value is Record { + return typeof value === 'object' && value !== null && !Array.isArray(value) +} + +function rscValues(html: string): Array { + const stream = [ + ...html.matchAll(/self\.__next_f\.push\(\[1,("(?:[^"\\]|\\.)*")\]\)/g), + ] + .map((match) => JSON.parse(match[1] ?? '""') as string) + .join('') + const values: Array = [] + for (const line of stream.split('\n')) { + const row = /^[0-9a-f]+:(.*)$/.exec(line) + if (!row?.[1]) continue + try { + values.push(JSON.parse(row[1]) as Json) + } catch { + // A text or import row, not a catalog record. + } + } + return values +} + +function ids(value: unknown, slug: string, what: string): Array { + if (!Array.isArray(value)) { + throw new Error(`mistral catalog ${slug}: ${what} ${JSON.stringify(value)}`) + } + const parsed: Array = [] + for (const id of value) { + if (typeof id !== 'string' || !MODEL_ID.test(id)) { + throw new Error( + `mistral catalog ${slug}: ${what} ${JSON.stringify(value)}`, + ) + } + if (!parsed.includes(id)) parsed.push(id) + } + return parsed +} + +function strings(value: unknown, slug: string, what: string): Array { + if (!Array.isArray(value)) { + throw new Error(`mistral catalog ${slug}: ${what} ${JSON.stringify(value)}`) + } + const parsed: Array = [] + for (const item of value) { + if (typeof item !== 'string' || item.length === 0) { + throw new Error( + `mistral catalog ${slug}: ${what} ${JSON.stringify(value)}`, + ) + } + parsed.push(item) + } + return parsed +} + +function instant(value: unknown, slug: string, what: string): string | null { + if (value === null) return null + if (typeof value !== 'string' || !Number.isFinite(Date.parse(value))) { + throw new Error(`mistral catalog ${slug}: ${what} ${JSON.stringify(value)}`) + } + return value +} + +function prices(value: unknown, slug: string): Array { + if (!Array.isArray(value)) { + throw new Error(`mistral catalog ${slug}: pricing ${JSON.stringify(value)}`) + } + return value.map((row) => { + if ( + !isRecord(row) || + (row.direction !== 'input' && row.direction !== 'output') || + typeof row.label !== 'string' || + row.label.length === 0 || + (row.unit !== null && typeof row.unit !== 'string') || + typeof row.priceUsd !== 'number' || + !Number.isFinite(row.priceUsd) + ) { + throw new Error( + `mistral catalog ${slug}: pricing row ${JSON.stringify(row)}`, + ) + } + return { + direction: row.direction, + label: row.label, + unit: row.unit, + priceUsd: row.priceUsd, + } + }) +} + +/** + * `null` is no successor. A record's `modelIds` are the successor's API + * ids. A number is Payload's unpopulated relation: the same page also + * embeds the record, and a page that never does throws. + */ +function replacementIds( + value: unknown, + slug: string, +): { ids: Array | null; unread: boolean } { + if (value === null) return { ids: null, unread: false } + if (typeof value === 'number' && Number.isInteger(value)) { + return { ids: null, unread: true } + } + if (!isRecord(value)) { + throw new Error(`mistral catalog ${slug}: replacement has no API name`) + } + const parsed = ids(value.modelIds, slug, 'replacement') + if (parsed.length === 0) { + throw new Error(`mistral catalog ${slug}: replacement has no API name`) + } + return { ids: parsed, unread: false } +} + +/** One catalog record, or null when `node` is some other RSC value. */ +function readModel(node: Record): CatalogDraft | null { + if (!REQUIRED.every((key) => key in node)) return null + const slug = node.slug + if (typeof slug !== 'string' || !SLUG.test(slug)) { + throw new Error(`mistral catalog: slug ${JSON.stringify(slug)}`) + } + const status = node.status + if (typeof status !== 'string' || !STATUSES.has(status)) { + throw new Error(`mistral catalog ${slug}: status ${JSON.stringify(status)}`) + } + // Family pages state no summary. Any other shape is unreadable. + if ( + node.shortDescription !== null && + typeof node.shortDescription !== 'string' + ) { + throw new Error(`mistral catalog ${slug}: shortDescription is not text`) + } + if (typeof node.isFree !== 'boolean') { + throw new Error(`mistral catalog ${slug}: isFree is not a boolean`) + } + const maxOutputTokens = node.maxOutputTokens + if ( + maxOutputTokens !== null && + (typeof maxOutputTokens !== 'number' || + !Number.isInteger(maxOutputTokens) || + maxOutputTokens < 0) + ) { + throw new Error( + `mistral catalog ${slug}: maxOutputTokens ${JSON.stringify(maxOutputTokens)}`, + ) + } + const replacement = replacementIds(node.replacedBy, slug) + return { + slug, + status: status as MistralCatalogModel['status'], + modelIds: ids(node.modelIds, slug, 'modelIds'), + shortDescription: node.shortDescription ?? '', + deprecatedAt: instant(node.deprecatedAt, slug, 'deprecatedAt'), + retiredAt: instant(node.retiredAt, slug, 'retiredAt'), + replacementIds: replacement.ids, + replacementUnread: replacement.unread, + inputs: strings(node.inputs, slug, 'inputs'), + outputs: strings(node.outputs, slug, 'outputs'), + features: strings(node.features, slug, 'features'), + maxOutputTokens, + releasedAt: instant(node.releasedAt, slug, 'releasedAt'), + pricing: prices(node.pricing, slug), + isFree: node.isFree, + } +} + +interface CatalogDraft extends MistralCatalogModel { + /** True when this copy's `replacedBy` is an unpopulated relation id. */ + replacementUnread: boolean +} + +function sameReplacement(prior: CatalogDraft, model: CatalogDraft): boolean { + if (prior.replacementUnread && model.replacementUnread) return true + // An unpopulated relation id agrees with the populated record, not with + // a copy that says there is no successor. + if (prior.replacementUnread) return model.replacementIds !== null + if (model.replacementUnread) return prior.replacementIds !== null + return ( + JSON.stringify(prior.replacementIds) === + JSON.stringify(model.replacementIds) + ) +} + +function withoutReplacement(model: CatalogDraft): string { + const { replacementIds: _ids, replacementUnread: _unread, ...rest } = model + return JSON.stringify(rest) +} + +function walk(node: unknown, out: Array): void { + if (Array.isArray(node)) { + for (const item of node) walk(item, out) + return + } + if (!isRecord(node)) return + const model = readModel(node) + if (model) out.push(model) + for (const value of Object.values(node)) walk(value, out) +} + +/** + * Catalog records in a docs HTML page, one per slug. An HTML page with + * no catalog record returns an empty list. Two records for one slug that + * disagree throw. + */ +export function parseMistralCatalog(html: string): Array { + if (!html.includes('__next_f')) return [] + const found: Array = [] + for (const value of rscValues(html)) walk(value, found) + const bySlug = new Map() + for (const model of found) { + const prior = bySlug.get(model.slug) + if (!prior) { + bySlug.set(model.slug, model) + continue + } + if ( + withoutReplacement(prior) !== withoutReplacement(model) || + !sameReplacement(prior, model) + ) { + throw new Error(`mistral catalog ${model.slug}: models disagree`) + } + if (prior.replacementUnread && !model.replacementUnread) { + bySlug.set(model.slug, model) + } + } + return [...bySlug.values()].map((model) => { + if (model.replacementUnread) { + throw new Error( + `mistral catalog ${model.slug}: replacement has no API name`, + ) + } + const { replacementUnread: _unread, ...rest } = model + return rest + }) +} + +/** The record for this page's slug, or null when the page has no catalog. */ +export function mistralPageCatalog( + html: string, + slug: string, +): MistralCatalogModel | null { + const models = parseMistralCatalog(html) + if (models.length === 0) return null + const own = models.filter((model) => model.slug === slug) + if (own.length !== 1) { + throw new Error( + `mistral model page ${slug}: catalog names ${String(own.length)} matching models`, + ) + } + return own[0] ?? null +} + +/** Epoch seconds for a catalog timestamp. Null stays null. */ +export function mistralCatalogInstant( + value: string | null, + what: string, +): number | null { + if (value === null) return null + const ms = Date.parse(value) + if (!Number.isFinite(ms)) { + throw new Error(`${what}: ${JSON.stringify(value)}`) + } + return ms / 1000 +} diff --git a/src/server/providers/mistral-pricing.test.ts b/src/server/providers/mistral-pricing.test.ts index a65ddb35..6cba4945 100644 --- a/src/server/providers/mistral-pricing.test.ts +++ b/src/server/providers/mistral-pricing.test.ts @@ -7,26 +7,31 @@ import { mistralModelPage, tip, } from './fixtures/mistral-model-page.ts' +import { mistralPageCatalog, parseMistralCatalog } from './mistral-catalog.ts' +import type { MistralCatalogModel } from './mistral-catalog.ts' import { + MISTRAL_WEBSEARCH_URL, copyMistralAliasFacts, indexMistralApiIds, indexMistralModalities, + mistralCatalogModalities, + mistralCatalogPrice, mistralConversationTools, mistralIndexSlugFor, mistralModelPricing, mistralRateCard, parseMistralApiIds, parseMistralApiSlugs, + parseMistralMakers, parseMistralMarkdownPrice, parseMistralModelIndex, - parseMistralPageMaxOutput, parseMistralPageFeatures, + parseMistralPageMaxOutput, parseMistralPageModalities, parseMistralPagePrice, parseMistralPricing, parseMistralSamePrice, parseMistralWebSearchTools, - MISTRAL_WEBSEARCH_URL, withDocumentInput, } from './mistral-pricing.ts' @@ -740,10 +745,8 @@ describe('mistral model page price and max output', () => { Small$0.15—$0.6 `, 'https://docs.mistral.ai/resources/changelogs': '', - 'https://docs.mistral.ai/models.md': - '| [Medium 3.5](/models/mistral-medium-3-5-26-04) | `mistral-medium-3-5` | Deprecated |', 'https://docs.mistral.ai/models': - 'x', + '| [Medium 3.5](/models/mistral-medium-3-5-26-04) | `mistral-medium-3-5` | Deprecated |', 'https://docs.mistral.ai/models/mistral-small-4-0-26-03': mistralModelPage( ['mistral-small-2603'], @@ -811,10 +814,8 @@ describe('mistral model page price and max output', () => { Small$0.15—$0.6 `, 'https://docs.mistral.ai/resources/changelogs': '', - 'https://docs.mistral.ai/models.md': `| [TTS](/models/voxtral-tts-26-03) | \`voxtral-mini-tts-2603\` | Deprecated | + 'https://docs.mistral.ai/models': `| [TTS](/models/voxtral-tts-26-03) | \`voxtral-mini-tts-2603\` | Deprecated | | [Leanstral](/models/leanstral-1-5) | \`labs-leanstral-1-5\` | Deprecated |`, - 'https://docs.mistral.ai/models': - 'x', 'https://docs.mistral.ai/models/mistral-small-4-0-26-03': mistralModelPage( ['mistral-small-2603'], @@ -972,7 +973,6 @@ describe('mistral model page features', () => { Small$0.15—$0.6 `, 'https://docs.mistral.ai/resources/changelogs': '', - 'https://docs.mistral.ai/models.md': '', 'https://docs.mistral.ai/models': '', [small]: page([feature('function-calling')], {}, ['mistral-small-2603']), [`${small}.md`]: '- Release date: 2026-03-16\n', @@ -1103,3 +1103,340 @@ describe('mistral web search tools', () => { expect(mistralConversationTools(null, tools)).toEqual([]) }) }) + +/** RSC payload holding catalog records, the shape of the live overview. */ +function catalogHtml(models: Array): string { + const stream = `1:${JSON.stringify(models)}\n` + return `` +} + +function catalogModel( + overrides: Record = {}, +): MistralCatalogModel { + return { + slug: 'mistral-large-4-0', + status: 'ga', + modelIds: ['mistral-large-4', 'mistral-large-4-0'], + shortDescription: 'Flagship.', + deprecatedAt: null, + retiredAt: null, + replacedBy: null, + replacementIds: null, + inputs: ['text'], + outputs: ['text'], + features: ['function-calling'], + maxOutputTokens: 128000, + releasedAt: '2026-10-05T12:00:00.000Z', + pricing: [ + { direction: 'input', label: 'Input', unit: '/M Tokens', priceUsd: 0.7 }, + { + direction: 'input', + label: 'Cached input', + unit: '/M Tokens', + priceUsd: 0.07, + }, + { + direction: 'output', + label: 'Output', + unit: '/M Tokens', + priceUsd: 2.1, + }, + ], + isFree: false, + ...overrides, + } as MistralCatalogModel +} + +describe('mistral catalog records', () => { + it('maps each API id to one slug and drops an id used twice', () => { + const html = catalogHtml([ + catalogModel({ slug: 'left', modelIds: ['one', 'shared'] }), + catalogModel({ slug: 'right', modelIds: ['shared', 'two'] }), + ]) + const slugs = parseMistralApiSlugs(html) + expect(slugs.get('one')).toBe('left') + expect(slugs.get('two')).toBe('right') + expect(slugs.has('shared')).toBe(false) + expect(() => + parseMistralApiSlugs(catalogHtml([{ slug: 'not-a-record' }])), + ).toThrow(/parsed 0 API slugs/) + expect(() => + parseMistralCatalog( + catalogHtml([ + catalogModel(), + catalogModel({ shortDescription: 'A different copy.' }), + ]), + ), + ).toThrow(/models disagree/) + }) + + it('throws on a status or date it cannot read', () => { + expect(() => + parseMistralCatalog(catalogHtml([catalogModel({ status: 'gone' })])), + ).toThrow(/status/) + expect(() => + parseMistralCatalog(catalogHtml([catalogModel({ releasedAt: 'soon' })])), + ).toThrow(/releasedAt/) + }) + + it('names a third-party maker and lists every API id', () => { + const { makers, named } = parseMistralMakers( + catalogHtml([ + catalogModel({ + slug: 'zai-glm-5-3', + modelIds: ['zai-glm-5-3', 'zai-glm-latest'], + shortDescription: 'A third-party model from Z.ai.', + }), + catalogModel(), + ]), + ) + expect(makers.get('zai-glm-5-3')).toBe('Z.ai') + expect(makers.get('zai-glm-latest')).toBe('Z.ai') + expect(named.has('mistral-large-4')).toBe(true) + expect(makers.has('mistral-large-4')).toBe(false) + expect( + parseMistralCatalog( + catalogHtml([catalogModel({ shortDescription: null })]), + )[0]?.shortDescription, + ).toBe('') + }) + + it('reads modalities, a token card, and a unit written inside the label', () => { + const ocr = catalogModel({ + slug: 'ocr-4-1', + inputs: ['image', 'document'], + outputs: ['reasoning', 'text'], + features: ['ocr', 'document-qna'], + }) + expect(mistralCatalogModalities(ocr)).toEqual({ + input: ['image', 'file'], + output: ['text'], + }) + expect( + mistralCatalogModalities( + catalogModel({ inputs: ['timeseries'], outputs: ['text'] }), + ), + ).toBeNull() + expect(mistralCatalogPrice(ocr)).toEqual({ + kind: 'tokens', + rates: { + input_tokens: 0.7 / 1e6, + cache_read_tokens: 0.07 / 1e6, + output_tokens: 2.1 / 1e6, + }, + }) + expect( + mistralCatalogPrice( + catalogModel({ + pricing: [ + { + direction: 'input', + label: 'Output (/M tokens)', + unit: null, + priceUsd: 3, + }, + ], + }), + ), + ).toEqual({ kind: 'tokens', rates: { output_tokens: 3 / 1e6 } }) + expect( + mistralCatalogPrice( + catalogModel({ + isFree: true, + pricing: [ + { + direction: 'input', + label: 'Input', + unit: '/M Tokens', + priceUsd: 0, + }, + { + direction: 'output', + label: 'Output', + unit: '/M Tokens', + priceUsd: 0, + }, + ], + }), + ), + ).toBeNull() + expect(() => + mistralCatalogPrice( + catalogModel({ + isFree: true, + pricing: [ + { + direction: 'input', + label: 'Input', + unit: '/M Tokens', + priceUsd: 1, + }, + ], + }), + ), + ).toThrow(/positive price/) + }) + + it('reads the matching page and throws when the catalog names another slug', () => { + const html = catalogHtml([catalogModel()]) + expect(parseMistralApiIds(html, 'mistral-large-4-0')).toEqual([ + 'mistral-large-4', + 'mistral-large-4-0', + ]) + expect(mistralPageCatalog(html, 'mistral-large-4-0')?.maxOutputTokens).toBe( + 128000, + ) + expect(() => mistralPageCatalog(html, 'other-page')).toThrow( + /catalog names 0 matching models/, + ) + expect(parseMistralCatalog('no payload')).toEqual([]) + }) + + it('prices a dropped row from the catalog and does not fetch the markdown twin', async () => { + const medium = catalogModel({ + slug: 'mistral-medium-3-5-26-04', + modelIds: ['mistral-medium-3-5', 'mistral-medium-latest'], + inputs: ['text'], + outputs: ['text'], + features: ['document-qna'], + maxOutputTokens: null, + releasedAt: '2026-04-28T12:00:00.000Z', + pricing: [ + { + direction: 'input', + label: 'Input', + unit: '/M Tokens', + priceUsd: 1.5, + }, + { + direction: 'output', + label: 'Output', + unit: '/M Tokens', + priceUsd: 7.5, + }, + ], + }) + const original = globalThis.fetch + const calls: Array = [] + const docs: Record = { + 'https://docs.mistral.ai/inference/pricing': `

Flagship models

+

Prices /M Tokens

+ + +
Small$0.15—$0.6
`, + 'https://docs.mistral.ai/resources/changelogs': '', + 'https://docs.mistral.ai/models': catalogHtml([medium]), + 'https://docs.mistral.ai/models/mistral-small-4-0-26-03': + mistralModelPage( + ['mistral-small-2603'], + [[tip('Text input'), tip('Text output')]], + ), + 'https://docs.mistral.ai/models/mistral-small-4-0-26-03.md': + '- Release date: 2026-03-16\n', + 'https://docs.mistral.ai/models/mistral-medium-3-5-26-04': catalogHtml([ + medium, + ]), + [MISTRAL_WEBSEARCH_URL]: MISTRAL_WEBSEARCH_GUIDE, + } + globalThis.fetch = ((url: string) => { + const href = String(url) + calls.push(href) + const body = docs[href] + return Promise.resolve( + body === undefined + ? new Response('missing', { status: 404 }) + : new Response(body), + ) + }) as typeof fetch + try { + const lookup = await mistralModelPricing(undefined, [ + 'mistral-small-2603', + 'mistral-medium-3-5', + 'mistral-medium-latest', + ]) + const row = lookup('mistral-medium-3-5') + const card = row.pricing + if (!card) throw new Error('expected a medium card') + expect( + price( + card as RateCard, + {}, + { input_tokens: 1_000_000, output_tokens: 1_000_000 }, + ), + ).toBeCloseTo(9, 6) + expect(row.factSources?.pricing).toMatchObject({ + sourceUrl: 'https://docs.mistral.ai/models/mistral-medium-3-5-26-04', + }) + expect(row.releasedAt).toBe(Date.parse('2026-04-28T12:00:00.000Z') / 1000) + expect(row.factSources?.releasedAt).toMatchObject({ + sourceUrl: 'https://docs.mistral.ai/models/mistral-medium-3-5-26-04', + path: 'Release date', + }) + expect(row.modalities).toEqual({ + input: ['text', 'file'], + output: ['text'], + }) + expect(lookup('mistral-medium-latest').pricing).toEqual(card) + expect(lookup.seen.has('mistral-medium-3-5')).toBe(true) + expect( + calls.some((href) => href.endsWith('mistral-medium-3-5-26-04.md')), + ).toBe(false) + } finally { + globalThis.fetch = original + } + }) + + it('treats an HTML body at the markdown twin as a missing page', async () => { + const original = globalThis.fetch + const docs: Record = { + 'https://docs.mistral.ai/inference/pricing': `

Flagship models

+

Prices /M Tokens

+ + +
Small$0.15—$0.6
`, + 'https://docs.mistral.ai/resources/changelogs': '', + 'https://docs.mistral.ai/models': + '| [Twin](/models/html-twin) | `html-twin-id` | GA |', + 'https://docs.mistral.ai/models/mistral-small-4-0-26-03': + mistralModelPage( + ['mistral-small-2603'], + [[tip('Text input'), tip('Text output')]], + ), + 'https://docs.mistral.ai/models/mistral-small-4-0-26-03.md': + '- Release date: 2026-03-16\n', + 'https://docs.mistral.ai/models/html-twin': mistralModelPage( + ['html-twin-id'], + [[tip('Text input'), tip('Text output')]], + ), + 'https://docs.mistral.ai/models/html-twin.md': + 'moved', + [MISTRAL_WEBSEARCH_URL]: MISTRAL_WEBSEARCH_GUIDE, + } + globalThis.fetch = ((url: string) => { + const body = docs[String(url)] + return Promise.resolve( + body === undefined + ? new Response('missing', { status: 404 }) + : new Response(body), + ) + }) as typeof fetch + try { + const lookup = await mistralModelPricing(undefined, [ + 'mistral-small-2603', + 'html-twin-id', + ]) + expect(lookup.seen.has('html-twin-id')).toBe(false) + expect(lookup('html-twin-id').pricing).toBeUndefined() + expect(lookup('html-twin-id').absent).toEqual({ + pricing: 'unavailable', + releasedAt: 'unavailable', + }) + expect(lookup('html-twin-id').modalities).toEqual({ + input: ['text'], + output: ['text'], + }) + } finally { + globalThis.fetch = original + } + }) +}) diff --git a/src/server/providers/mistral-pricing.ts b/src/server/providers/mistral-pricing.ts index 2b4a3aac..eeb6162a 100644 --- a/src/server/providers/mistral-pricing.ts +++ b/src/server/providers/mistral-pricing.ts @@ -23,13 +23,15 @@ * scale the listing uses (262144 shown as 256k). * * A model Mistral drops from the pricing table keeps its page. The HTML - * widget is often gone; the page's markdown twin still states `Pricing:`. - * That line is the card (#543). The models overview pairs the API name - * with the page slug, including deprecated rows the index-slug rules miss + * widget is often gone. The catalog record states `pricing`, and the + * markdown twin's `Pricing:` line is the older statement (#543). The + * models overview pairs each API id with the page slug, including + * deprecated rows the index-slug rules miss * (`mistral-medium-3-5` → `mistral-medium-3-5-26-04`). * - * The markdown twin's `Release date:` line is the model's `releasedAt` - * (#708). The listing's `created` is the request time, not a date. + * `releasedAt` is the catalog record's `releasedAt` (#708). The markdown + * twin's `Release date:` line is the older statement. The listing's + * `created` is the request time, not a date. */ import { cardPrice, @@ -39,6 +41,12 @@ import { import type { Expr, RateCard } from '@modelschemas/rate-card' import { MISTRAL_DEPRECATIONS_URL } from './deprecations.ts' +import type { MistralCatalogModel } from './mistral-catalog.ts' +import { + mistralCatalogInstant, + mistralPageCatalog, + parseMistralCatalog, +} from './mistral-catalog.ts' import { serverToolsSilent, tagDocsFacts } from './fact-sources.ts' import { assertParsed, cachedDocs, mapConcurrent } from './model-facts.ts' import { mistralDocsMarkdown } from './reasoning-config.ts' @@ -57,6 +65,14 @@ function isMissingDocsPage(error: unknown): boolean { return error instanceof Error && /→ 404\b/.test(error.message) } +/** + * `.md` now redirects to the HTML page (checked 2026-11-27). That document + * is not the markdown twin: a missing line there is not "no price". + */ +function isHtmlDocument(body: string): boolean { + return /]/i.test(body) +} + export interface MistralTokenRates { kind: 'tokens' rates: Record @@ -307,6 +323,8 @@ export function mistralRateCard( * shares nothing is no mapping. */ export function parseMistralApiIds(html: string, slug: string): Array { + const catalog = mistralPageCatalog(html, slug) + if (catalog) return catalog.modelIds // The page embeds the array as JSON (`"names":["id"]`) and, in the RSC // payload, with escaped quotes (`names\":["id"]`). const blocks = [ @@ -490,6 +508,34 @@ function blockModalities(rows: RscRows, block: Json): MistralModalities | null { return { input: ordered(found.input), output: ordered(found.output) } } +/** + * Modalities a catalog record states. `reasoning` on the output is the + * thinking marker, not a medium. An unknown word, or a side with no known + * medium, is null: a shorter list would read as the whole answer. + */ +export function mistralCatalogModalities( + model: MistralCatalogModel, +): MistralModalities | null { + const found = { input: new Set(), output: new Set() } + const read = (words: Array, side: 'input' | 'output'): boolean => { + for (const word of words) { + const key = word.toLowerCase() + if (key === 'reasoning' && side === 'output') continue + const medium = MISTRAL_MEDIA[key] + if (!medium) return false + found[side].add(medium) + } + return true + } + if (!read(model.inputs, 'input') || !read(model.outputs, 'output')) { + return null + } + if (found.input.size === 0 || found.output.size === 0) return null + const ordered = (have: Set) => + Object.values(MISTRAL_MEDIA).filter((medium) => have.has(medium)) + return { input: ordered(found.input), output: ordered(found.output) } +} + /** * Modalities a model page states: the tooltips ("Text input", "Image * input", "Text output") of the block beside its "Modalities" heading, read @@ -904,6 +950,73 @@ export function parseMistralPagePrice(html: string): MistralListedPrice | null { return priced[0] ?? null } +function catalogMeter(row: MistralCatalogModel['pricing'][number]): { + side: 'input' | 'output' + label?: string + denominator: string + amount: number +} { + const embedded = /^(input|output|cached input) \(([^)]+)\)$/i.exec( + row.label.trim(), + ) + if (row.unit === null) { + const name = embedded?.[1]?.toLowerCase() + const denominator = embedded?.[2] + if (!name || !denominator) { + throw new Error( + `mistral model page pricing: unreadable catalog meter ${JSON.stringify(row.label)}`, + ) + } + return { + side: name === 'output' ? 'output' : 'input', + ...(name === 'cached input' ? { label: 'Cached input' } : {}), + denominator, + amount: row.priceUsd, + } + } + const name = row.label.trim().toLowerCase() + if (name !== 'input' && name !== 'output' && name !== 'cached input') { + throw new Error( + `mistral model page pricing: unknown label ${JSON.stringify(row.label)}`, + ) + } + if ( + (name === 'output' && row.direction !== 'output') || + (name !== 'output' && row.direction !== 'input') + ) { + throw new Error( + `mistral model page pricing: label ${JSON.stringify(row.label)} disagrees with ${row.direction}`, + ) + } + return { + side: row.direction, + ...(name === 'cached input' ? { label: 'Cached input' } : {}), + denominator: row.unit, + amount: row.priceUsd, + } +} + +/** The catalog record's USD price. An all-zero or empty list is no card. */ +export function mistralCatalogPrice( + model: MistralCatalogModel, +): MistralListedPrice | null { + if (model.isFree && model.pricing.some((row) => row.priceUsd > 0)) { + throw new Error( + 'mistral model page pricing: free catalog row has a positive price', + ) + } + const meters = [] + for (const row of model.pricing) { + if (row.priceUsd < 0) { + throw new Error('mistral model page pricing: negative amount') + } + if (row.priceUsd === 0) continue + meters.push(catalogMeter(row)) + } + if (meters.length === 0) return null + return listedFromMeters(meters) +} + /** * The model page markdown's `Pricing:` line. One line, meters separated by * `;`. `Free` or an all-zero line is no card. A line that is present and @@ -1018,7 +1131,34 @@ export function parseMistralMarkdownReleaseDate( * tables. A name two rows send to different slugs is omitted. An overview * that pairs nothing throws: the tables moved. */ +function slugsFromCatalog( + models: Array, +): Map { + const out = new Map() + const ambiguous = new Set() + for (const model of models) { + for (const id of model.modelIds) { + const prior = out.get(id) + if (prior && prior !== model.slug) { + ambiguous.add(id) + continue + } + out.set(id, model.slug) + } + } + for (const id of ambiguous) out.delete(id) + if (out.size === 0) { + throw new Error('mistral models overview: parsed 0 API slugs') + } + return out +} + export function parseMistralApiSlugs(markdown: string): Map { + const catalog = parseMistralCatalog(markdown) + if (catalog.length > 0) return slugsFromCatalog(catalog) + if (markdown.includes('__next_f')) { + throw new Error('mistral models overview: parsed 0 API slugs') + } const out = new Map() const ambiguous = new Set() for (const match of markdown.matchAll( @@ -1077,6 +1217,25 @@ export function parseMistralMakers(markdown: string): { makers: Map named: Set } { + const catalog = parseMistralCatalog(markdown) + if (catalog.length > 0) { + parseMistralApiSlugs(markdown) + const makers = new Map() + const named = new Set() + for (const model of catalog) { + const maker = mistralSummaryMaker(model.shortDescription) + for (const id of model.modelIds) { + named.add(id) + if (!maker) continue + const prior = makers.get(id) + if (prior && prior !== maker) { + throw new Error(`mistral models overview: ${id} names two makers`) + } + makers.set(id, maker) + } + } + return { makers, named } + } parseMistralApiSlugs(markdown) const makers = new Map() const named = new Set() @@ -1109,8 +1268,10 @@ export interface MistralModelPage { * card the source could not be read for. */ priceUnread?: boolean - /** The markdown twin's `Release date`, epoch seconds. */ + /** The markdown twin's `Release date`, or the catalog timestamp, epoch seconds. */ releasedAt?: number | null + /** The HTML page, when `releasedAt` was read from the catalog record. */ + releaseUrl?: string /** Hash of the markdown twin `releasedAt` was read from. */ markdownHash?: string /** The markdown twin 404'd: its release date was not read. */ @@ -1327,12 +1488,12 @@ export interface MistralPricingLookup { } /** - * The rendered web-search guide. `llms.txt` still links - * `https://docs.mistral.ai/studio/agents/agent-tools/websearch.md`, which - * 404s (checked 2026-11-19). This HTML page is what serves the guide. + * The web-search guide as markdown. `/studio/agents/agent-tools/websearch.md` + * redirects to this `llms.txt` document (checked 2026-11-27). The HTML page + * is the same move as the reasoning guide. */ export const MISTRAL_WEBSEARCH_URL = - 'https://docs.mistral.ai/studio/agents/agent-tools/websearch' + 'https://docs.mistral.ai/llms/studio/agents/agent-tools/websearch/llms.txt' /** * The web search guide's tool ids (#409). It states the tool "allows any @@ -1401,50 +1562,80 @@ export async function mistralModelPricing( const url = MISTRAL_MODEL_PAGE(slug) const page = await cached(kv, url, async () => { const body = await fetchText(url) - const ids = parseMistralApiIds(body, slug) - const features = parseMistralPageFeatures(body) + const catalog = mistralPageCatalog(body, slug) + const ids = catalog ? catalog.modelIds : parseMistralApiIds(body, slug) + const features = catalog + ? catalog.features + : parseMistralPageFeatures(body) if (ids.length === 0) { throw new Error(`mistral model page ${slug}: parsed 0 API ids`) } let pagePrice = parseMistralPagePrice(body) + if (!pagePrice && catalog) pagePrice = mistralCatalogPrice(catalog) let priceUrl: string | undefined let priceHash: string | undefined let priceUnread = false - // The markdown twin states the release date on every page, and the - // price when the HTML widget is gone. A 404 leaves both unread. - const mdUrl = `${url}.md` - let markdown: string | null = null - try { - markdown = await fetchText(mdUrl) - } catch (error) { - if (!isMissingDocsPage(error)) throw error - } - const markdownHash = markdown ? await sha256Text(markdown) : undefined - // The pricing table already priced this slug. Its page's markdown - // is a second statement of the same card, not a replacement. - if (!pagePrice && !bySlug.has(slug)) { - // The twin is the price source. A 404 is not "no price". - if (markdown === null) priceUnread = true - const stated = markdown ? parseMistralMarkdownPrice(markdown) : null - if (stated && markdownHash) { - pagePrice = stated - priceUrl = mdUrl - priceHash = markdownHash + const hash = await sha256Text(body) + let releasedAt: number | null = null + let releaseUrl: string | undefined + let markdownHash: string | undefined + let markdownUnread = false + if (catalog) { + releasedAt = mistralCatalogInstant( + catalog.releasedAt, + 'mistral model page release date', + ) + releaseUrl = url + if (pagePrice) { + priceUrl = url + priceHash = hash + } + } else { + // The markdown twin states the release date, and the price when + // the HTML widget is gone. A 404 leaves both unread. An HTML + // redirect is the same as a missing twin. + const mdUrl = `${url}.md` + let markdown: string | null = null + try { + markdown = await fetchText(mdUrl) + } catch (error) { + if (!isMissingDocsPage(error)) throw error + } + if (markdown && isHtmlDocument(markdown)) markdown = null + markdownHash = markdown ? await sha256Text(markdown) : undefined + markdownUnread = markdown === null + releasedAt = markdown ? parseMistralMarkdownReleaseDate(markdown) : null + // The pricing table already priced this slug. Its page's markdown + // is a second statement of the same card, not a replacement. + if (!pagePrice && !bySlug.has(slug)) { + // The twin is the price source. A 404 is not "no price". + if (markdown === null) priceUnread = true + const stated = markdown ? parseMistralMarkdownPrice(markdown) : null + if (stated && markdownHash) { + pagePrice = stated + priceUrl = mdUrl + priceHash = markdownHash + } } } return { - releasedAt: markdown ? parseMistralMarkdownReleaseDate(markdown) : null, + releasedAt, + ...(releaseUrl ? { releaseUrl } : {}), ...(markdownHash ? { markdownHash } : {}), - ...(markdown === null ? { markdownUnread: true } : {}), + ...(markdownUnread ? { markdownUnread: true } : {}), ids, - hash: await sha256Text(body), + hash, serverTools: parseMistralPageTools(body), modalities: withDocumentInput( - parseMistralPageModalities(body), + catalog + ? mistralCatalogModalities(catalog) + : parseMistralPageModalities(body), features, ), features, - maxOutput: parseMistralPageMaxOutput(body), + maxOutput: catalog + ? catalog.maxOutputTokens + : parseMistralPageMaxOutput(body), pagePrice, ...(priceUrl && priceHash ? { priceUrl, priceHash } : {}), ...(priceUnread ? { priceUnread: true } : {}), @@ -1525,7 +1716,7 @@ export async function mistralModelPricing( pages, (page) => page.releasedAt, (page) => ({ - url: `${MISTRAL_MODEL_PAGE(page.slug)}.md`, + url: page.releaseUrl ?? `${MISTRAL_MODEL_PAGE(page.slug)}.md`, hash: page.markdownHash ?? page.hash, }), ) diff --git a/src/server/providers/model-facts.ts b/src/server/providers/model-facts.ts index cdc3eb86..3e2af749 100644 --- a/src/server/providers/model-facts.ts +++ b/src/server/providers/model-facts.ts @@ -307,7 +307,9 @@ export const DOCS_TTL_SECONDS = 6 * 60 * 60 // v51: a DashScope model page entry may name the info page it followed // (`sourceUrl`, #772), and a page with no Context limits section now // parses; a v50 entry is the old parse. -const DOCS_CACHE_VERSION = 'v51' +// v52: Mistral's overview, model pages, reasoning guide and web-search +// guide moved (#771). A v51 model-page entry has no catalog read. +const DOCS_CACHE_VERSION = 'v52' /** Fresh-window key for one parsed docs page. Shared with the stale copy. */ export function docsCacheKey(url: string): string { diff --git a/src/server/providers/reasoning-config.ts b/src/server/providers/reasoning-config.ts index 539b6e60..f4684c66 100644 --- a/src/server/providers/reasoning-config.ts +++ b/src/server/providers/reasoning-config.ts @@ -22,14 +22,13 @@ import { fetchText, reasoningViolation, sha256Text } from './types.ts' import type { ModelFactSources, ModelInfo, ModelReasoning } from './types.ts' /** - * The rendered reasoning guide. `https://docs.mistral.ai/llms.txt` links - * `https://docs.mistral.ai/inference/conversations/reasoning.md`, and the - * old `/studio/conversations/reasoning.md` redirects there, but that - * markdown twin 404s (checked 2026-11-19). This HTML page is what serves - * the guide. + * The reasoning guide as markdown. The HTML page's converted text no longer + * keeps the `reasoning_effort` bullets (checked 2026-11-27). `llms.txt` + * links this document, and `/inference/conversations/reasoning.md` redirects + * here. */ export const MISTRAL_REASONING_URL = - 'https://docs.mistral.ai/inference/conversations/reasoning' + 'https://docs.mistral.ai/llms/inference/conversations/reasoning/llms.txt' /** * Mistral's docs site returns a full HTML document where `llms.txt` still