Skip to content

docs: reduce oversized pages and prevent full OpenAPI markdown dumps - #1271

Open
ethanfinkel wants to merge 1 commit into
OpenRouterTeam:mainfrom
ethanfinkel:docs/fix-truncated-docs-and-payloads
Open

ethanfinkel wants to merge 1 commit into
OpenRouterTeam:mainfrom
ethanfinkel:docs/fix-truncated-docs-and-payloads

Conversation

@ethanfinkel

Copy link
Copy Markdown
Contributor

Summary

Coding agents frequently hit fetch truncation limits (~50 KB) when reading key OpenRouter documentation pages and OpenAPI reference endpoints, causing them to miss routing options (require_parameters, quantizations, data_collection, zdr, max_price), tool calling patterns, endpoint schemas, or skip the Models API entirely out of concern that the payload is too large.

This PR addresses four root causes without removing any technical documentation or breaking existing anchors:

  1. Prevent Mintlify from dumping the full 2.36 MB OpenAPI spec on API Reference .md pages (docs.json, guides/features/decisions.mdx)

    • Set "markdown": { "schema": false } in docs.json so Mintlify omits the raw monolithic openapi.yaml dump (all tags, provider enums, and 1,082 schemas) from agent-facing Markdown exports while keeping endpoint documentation intact.
    • Added a concise markdown.instructions hint pointing agents to targeted single-model and filtered catalog endpoints (GET /api/v1/model/{author}/{slug}, GET /api/v1/models/{author}/{slug}/endpoints, and filtered GET /api/v1/models).
    • Added a complete Response schema reference (covering answers union types, annotations, and usage) and the trace request field to guides/features/decisions.mdx.
  2. Compact guides/routing/provider-selection.mdx from 130.8 KB → 42.2 KB (-67.7%)

    • Removed 20 broken, truncated raw Output JSON dumps (34.8 KB total, including 4–6.4 KB base64 encryptedContent blobs for "Hello" responses).
    • Kept the full 5-language <CodeGroup> on the first example (Provider Sorting) and the TypeScript SDK + cURL header example (Anthropic Beta Features), replaced the other 18 repetitive HTTP boilerplate blocks with focused json request-body snippets, and documented TypeScript SDK camelCase field names in the summary table.
    • Preserved all headings, anchor IDs, prose, tables, callouts, <QuantizationLevels />, and <TermsOfServiceDescriptions />.
  3. Compact oversized Tool Calling & Responses guides under ~41 KB

    • guides/features/tool-calling.mdx: 60.2 KB → 40.4 KB (-32.9%) — kept all Agent SDK, Responses/Chat Completions JSON, TypeScript SDK, and Python examples; trimmed duplicated TypeScript (fetch), verbose Go, and jq bash loops from the walkthrough and streaming sections.
    • api_reference/responses/tool-calling.mdx: 54.1 KB → 32.9 KB (-39.3%) — removed 4 truncated 42-line Output dumps and replaced 4 repeated 4-language boilerplate sections (Force Specific Tool, Disable Tool Calling, Multiple Tools, Parallel Tool Calls) with concise JSON request/output examples.
    • api_reference/responses/web-search.mdx: 66.5 KB → 32.0 KB (-52.0%) — removed 5 truncated 6.9 KB encrypted_content Output dumps.
    • agent-sdk/call-model/text-generation.mdx: 50.7 KB → 38.8 KB (-23.4%) — compacted an 8 KB single-line encrypted_content Output dump and a 4.5 KB story dump.
  4. Surface single-model & filtered Models API queries prominently

    • guides/overview/models.mdx: 37.3 KB → 32.0 KB (-14.3%) — added a top <Tip> explaining how to avoid the ~200 KB+ unfiltered catalog (GET /api/v1/model/{author}/{slug}, GET /api/v1/models/{author}/{slug}/endpoints, and ?q=...&limit=...), added the full query-parameter summary table (q, limit, offset, min_price, max_price, context, zdr, region, arch, input_modalities), and replaced two giant truncated Output dumps (including a …[192000 chars clipped]… blob) with clean JSON examples.
    • api_reference/models.mdx: Added a matching <Tip> at the top of the page.
    • openapi/openapi.yaml: Added a concise operation description on GET /models recommending query filters or single-model lookup to keep payloads small.

Size Comparison

File Before After Change
guides/routing/provider-selection.mdx 130,775 B 42,231 B -67.7%
api_reference/responses/web-search.mdx 66,527 B 31,960 B -52.0%
api_reference/responses/tool-calling.mdx 54,136 B 32,883 B -39.3%
guides/features/tool-calling.mdx 60,215 B 40,378 B -32.9%
agent-sdk/call-model/text-generation.mdx 50,744 B 38,848 B -23.4%
guides/overview/models.mdx 37,346 B 32,019 B -14.3%
guides/features/decisions.mdx 40,331 B 42,334 B +5.0%
api_reference/models.mdx 22,946 B 23,415 B +2.0%

Validation

  • Ran mint validate --no-build --format json: passed with 0 errors.
  • Verified balanced code fences, balanced <CodeGroup> tags, valid docs.json, and all internal and cross-document anchor links.
@mintlify

mintlify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Preview approved

@kenrogers approved a Mintlify preview for commit 76bd3b6.

@mintlify

mintlify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
openrouter-production 🟢 Ready View Preview Nov 25, 2026, 5:28 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

This branch was successfully deployed

1 active deployment
staging — 76bd3b67 Deployed Nov 25, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant