docs: add Regional endpoints page (Global + US) for the inference API - #58
Open
sejori wants to merge 1 commit into
Open
docs: add Regional endpoints page (Global + US) for the inference API#58sejori wants to merge 1 commit into
sejori wants to merge 1 commit into
Conversation
The dwctl wrong-region 401 copy links to /inference-api/regional-endpoints, so the page content is version-controlled here next to that URL contract rather than in Sanity. It renders through the same pipeline as the synthesized model pages: static param + content override in the doc page route, the .md endpoint, a sidebar entry anchored beside Creating an API Key, and a sitemap route. A Sanity page with the same slug takes over if one is created later.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Adds a new version-controlled, in-repo documentation page at /inference-api/regional-endpoints describing Global vs US Inference API regions (base URLs, consoles, region-bound API keys, and wrong-region 401 behavior). This extends the existing “synthesized page” pattern used for model artifacts so the URL/content can be treated as part of an external error-copy contract.
Changes:
- Introduces
src/lib/regional-endpoints.tswith the page slug/title/description and the synthesized markdown body. - Hooks the synthesized page into the main doc route (
page.tsx) and the raw markdown endpoint (/api/markdown/...) so both HTML and.mdvariants work. - Adds navigation + indexing integration via the inference API sidebar organizer and the sitemap.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/regional-endpoints.ts | Defines the synthesized “Regional endpoints” page slug/metadata and its markdown content. |
| src/app/[product]/[...slug]/page.tsx | Adds static params + metadata + content resolution hook for the synthesized regional-endpoints page. |
| src/app/api/markdown/[product]/[...slug]/route.ts | Serves /inference-api/regional-endpoints.md from the synthesized markdown source. |
| src/lib/inference-api-sidebar.ts | Injects the synthesized page into the inference-api sidebar (anchored near “Creating an API Key”), unless a Sanity page exists for the slug. |
| src/app/sitemap.ts | Adds the synthesized page to the generated sitemap. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
sejori
added a commit
to doublewordai/control-layer
that referenced
this pull request
Aug 29, 2026
…#1541) ## What Rewrites the `Invalid API key` 401 copy so a key rejected because it was created in the other region no longer reads as "your key is broken". The message now suggests checking that the request's base URL matches the region the key was created in, and links the regional-endpoints docs page: > Invalid API key. API keys are region-bound: if you expected this key to work, check that your base URL matches the region the key was created in. See https://docs.doubleword.ai/inference-api/regional-endpoints Status code (401) and error schema (`authentication_error` / `invalid_api_key`) are unchanged. ## Where - `dwctl/src/errors.rs`: new shared `INVALID_API_KEY_MESSAGE` constant so the copy cannot drift between surfaces. - `dwctl/src/api/handlers/ai_models.rs`: the `GET /ai/v1/models` unknown-key 401 (the first endpoint people hit when smoke-testing a key). - `dwctl/src/auth/current_user.rs`: the `CurrentUser` extractor's unknown-bearer-key rejection, which gates every other dwctl-authenticated surface. The extractor previously accumulated per-method auth errors but always returned a message-less generic 401 ("Authentication required"), so the specific copy never reached the client; it now propagates the first specific failure message (API-key auth is attempted first). - `dwctl/src/openapi/ai.rs`: the documented error example, kept in sync with the live copy. The realtime proxy path (onwards) is deliberately untouched: it rejects unknown keys with a 403 key-set miss, so changing it would not be a copy-only 401 change. ## Notes The error body intentionally does **not** enumerate regional base URLs — it stays generic and defers to the docs page, which pairs each key with its base URL. The docs page ships in doublewordai/documentation#58 (held until release). Tests assert the new copy on both surfaces and that no regional API base URL appears in the error body. COR-585
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Regional endpoints page at
/inference-api/regional-endpointscovering:api.doubleword.ai) and US (served byapi.us.doubleword.ai), each with its own console, accounts, keys, and credits.This page is the link target of the control-layer 401 copy change (doublewordai/control-layer#1541), which points users here instead of enumerating base URLs in the error body.
How
Doc content normally lives in Sanity (AGENTS.md), but this page's URL is now part of the API's error-copy contract, so the content is version-controlled in-repo and rendered through the same pipeline as the synthesized model pages:
src/lib/regional-endpoints.ts— page content + metadata (new).src/app/[product]/[...slug]/page.tsx— static param, metadata, and content hooks (mirrors themodelsspecial-case).src/app/api/markdown/[product]/[...slug]/route.ts— serves/inference-api/regional-endpoints.md.src/lib/inference-api-sidebar.ts— sidebar entry anchored beside "Creating an API Key" under Using the Platform.src/app/sitemap.ts— sitemap entry.If the page is later migrated into Sanity under the same slug, the sidebar and page route already prefer the Sanity version; the hooks can then be removed.
Not included: an llms.txt entry (that route iterates Sanity docs directly; can follow when/if the page moves to Sanity).
Verification
mainare unchanged).main(the one pre-existingsearch.test.tsstripMarkdown failure exists onmainand is unrelated).Status
HELD per release policy — do not merge yet. The control-layer 401 copy (doublewordai/control-layer#1541) links to this page's URL; this PR should merge as part of the coordinated release.