Streamline LLM Gateway quickstart: tabbed SDK examples - #5981
Draft
langsmith-fleet[bot] wants to merge 34 commits into
Draft
langsmith-fleet[bot] wants to merge 34 commits into
langsmith-fleet[bot] wants to merge 34 commits into
Conversation
- Replace scattered code blocks with a single tabbed 'Make a call' section covering cURL, OpenAI SDK (Python/TS), Anthropic SDK (Python/TS), Deep Agents (Python/TS), and init_chat_model - Move the misplaced create_deep_agent snippet into the Deep Agents tab alongside the LANGSMITH_GATEWAY=true setup step - Collapse LANGSMITH_GATEWAY env var details into named accordions at the bottom of the page (LangChain Python and TypeScript separately) - Remove prose that duplicates what is already visible in code examples - Simplify the env var setup block — LANGSMITH_API_KEY listed first
langsmith-fleet
Bot
requested review from
Florence Morris (fjmorris) and
Kathryn May (katmayb)
September 10, 2026 19:03
added 10 commits
September 10, 2026 20:06
- Anthropic SDK: use hardcoded gateway.smith.langchain.com base URL instead of string-replacing LANGSMITH_GATEWAY_BASE_URL - init_chat_model: fix first example to use model_provider='openai' with explicit base_url/api_key (matches llm-gateway-credits.mdx pattern) - Deep Agents: use provider:model colon format (anthropic:claude-opus-5) consistent with Deep Agents models docs
The model_provider='openai' + model='anthropic/claude-opus-5' combination was confusing. Replace with a single clean example using the langsmith: provider prefix and LANGSMITH_GATEWAY=true, which is unambiguous and requires no explanation of the OpenAI-compat forwarding internals.
…y notes - Rename LANGSMITH_GATEWAY_BASE_URL to GATEWAY_URL in shell examples with a comment clarifying it is a local shell variable, not one the SDKs read - Add two-sentence intro before the tabs explaining the two flows: unified /v1 endpoint (cURL, OpenAI/Anthropic SDKs) vs LANGSMITH_GATEWAY env var (LangChain, Deep Agents) - Add Warning: do not append /v1 path to LANGSMITH_GATEWAY value; SDK appends provider path automatically — doubled path causes failures - Add comment in Anthropic SDK tabs: gateway root has no /v1 suffix - Add Note: only chat models route through LANGSMITH_GATEWAY; embeddings and legacy LLM integrations are unaffected - Add Note: 403 at call time (not setup time) indicates missing gateway:invoke permission - Add Note to TypeScript accordion flagging rows that may diverge from Python implementation; recommend verifying against @langchain/openai
Gateway Credits are only for moonshotai/kimi models on Fireworks — they are not a general alternative for BYOK models. Remove the incorrect suggestion that langsmith: prefix = Gateway Credits access, and remove the 'You can call a Gateway Credits model without a provider secret' intro sentence. Replace with a single link to the credits page in the how-the-gateway-works step. The quickstart now stays focused on BYOK usage.
- Drop 'two ways to reach the gateway' block before tabs — context is now inline in each tab as prose above the code block - Remove 'Pick the tab that matches your SDK' line - Move code comments on GATEWAY_URL into prose lines above code blocks - Rename 'LANGSMITH_GATEWAY env var (LangChain and Deep Agents)' to 'Using LANGSMITH_GATEWAY'
The two tables had identical rows — only column names (OPENAI_API_BASE vs OPENAI_BASE_URL, base_url= kwarg vs configuration.baseURL) and 3 'Resolved key' cells differed between Python and TypeScript. Replace the two accordions with one that: - Lists supported models for Python and TypeScript separately - Uses a single merged table with generic column headers - Marks the 3 diverging rows inline with a dagger (†) footnote
…to tabs - Add 'Gateway URLs' section with US / EU / BYOC base URLs in a table, plus a two-bullet explanation of unified /v1 vs direct provider routes with links to the relevant reference pages - Remove separate 'Set your API key' step; fold LANGSMITH_API_KEY export into each tab's setup block alongside LANGSMITH_GATEWAY where relevant, so all env vars are visible in context - Inline regional URL comments in GATEWAY_URL definitions and LANGSMITH_GATEWAY examples (US default / EU / BYOC on commented lines) - Remove numbered steps from 'Make a call', 'View your trace', and 'Set a spend policy' since step 1 is gone
- Remove 'Gateway URLs' section from near the top - Strip regional URL comments from all inline code examples - Add 'Regional URLs and endpoint styles' section before Next steps, covering US/EU/BYOC base URLs and the unified /v1 vs direct provider route distinction
- Remove intro sentence 'Set your API key...' - Replace flat SDK tabs with format-based outer tabs: Chat completions / Messages / Responses / Deep Agents / LangChain - Each tab uses <CodeGroup> for language switching (cURL, Python, TypeScript) matching the pattern used in llm-gateway-api-formats.mdx - Use consistent prompt 'Explain what an LLM gateway does in one sentence.' across all examples - Messages tab: add Anthropic-Version header to cURL example - Responses tab: use client.responses.create per reference snippets
Four pages linked to anchors that no longer exist after the quickstart was restructured: - #2-make-a-call → #make-a-call (step numbering removed) - #using-langchain-and-deep-agents → #using-langsmith_gateway (section renamed)
added 12 commits
September 11, 2026 18:46
- Cut redundant intro sentence - Cut 'A 200 response...' line — self-obvious - Cut 'How the gateway handles requests' section — belongs on concepts page, replaced with a link in Next steps - Rename 'Using LANGSMITH_GATEWAY' -> 'Automatic routing (LangChain and Deep Agents)' - Remove 'Setup' CodeGroup tab from Deep Agents and LangChain/per-request tabs; fold env var exports into comments at the top of each code block - Rename 'LangChain' tab to 'LangChain / per-request' and add a 'Deep Agents' code block alongside it — clarifies that the langsmith: prefix is per-request routing (no LANGSMITH_GATEWAY needed) and works in both LangChain and Deep Agents since Deep Agents uses init_chat_model under the hood
…ateway-quickstart
- Prerequisites: tighten 'To set this up, see' -> 'See'; cut 403 Note (covered by the permissions bullet; troubleshooting not a prereq) - Tab intros: 'Works with' -> 'Use this with' (active, task-first) - Deep Agents Python: remove unused 'import os' - View your trace: 'navigate to' -> 'go to'; cut trailing Note about separate gateway/app traces (edge case, not quickstart material) - Set a spend policy: tighten closing line to single link - Automatic routing Warning: 'will cause' (future tense) -> 'causes' - Collapse two Notes into one (chat-models-only + LANGSMITH_GATEWAY_API_KEY) - Regional URLs: remove redundant 'When you set LANGSMITH_GATEWAY...' sentence; tighten endpoint bullet descriptions - Accordion footnote: shorten
- Rename 'LangChain / per-request' tab to 'LangChain' - Show LANGSMITH_GATEWAY=true pattern (consistent with Deep Agents tab) instead of the langsmith: prefix as the main example - Remove the Deep Agents code block from the LangChain tab - Add a <Tip> explaining the langsmith: per-model prefix as an alternative to the global LANGSMITH_GATEWAY setting; notes it works with both init_chat_model and create_deep_agent - Fix double-comment formatting: split into two separate comment lines in both Deep Agents Python and TypeScript blocks
- Remove LangChain tab (keep Deep Agents, Chat completions, Messages, Responses) - Move langsmith: per-agent tip into Deep Agents tab as a <Tip> block, showing create_deep_agent(model='langsmith:anthropic/claude-opus-5') and explaining LANGSMITH_GATEWAY is global vs per-agent via langsmith: prefix - Fix Deep Agents comment formatting: each export on its own comment line - Add LANGSMITH_API_KEY (first) to the Automatic routing code block - Endpoint styles: unified /v1 is recommended and translates between API formats; direct provider routes pass through without format translation
- Remove <Accordion> wrapper — content is now always visible - Rename to 'Supported LangChain integrations' heading (h3 under section) - Collapse Python/TypeScript package bullet lists into a single table with Provider, Python package, TypeScript package columns - Replace 12-row truth table with simple ordered precedence rules: Base URL (4 rules) and API key (3 rules), first match wins - Fix Warning: now shown after the URL form of LANGSMITH_GATEWAY is introduced (commented lines), so the 'no path suffix' instruction makes sense in context - Add commented EU/BYOC URL variants to the env var block so the Warning's mention of URL values is no longer a surprise - Collapse TypeScript divergence note to one sentence at the bottom
… URLs - 'Automatic routing (LangChain and Deep Agents)' → 'Using LangChain SDKs' - Split two-point Note into two separate Notes (chat models / LANGSMITH_GATEWAY_API_KEY) - Replace 7-rule precedence list with a 3-row override table + 1 sentence for key resolution — much faster to scan - 'Regional URLs and endpoint styles' → 'Gateway URLs' with two h3 subsections: 'Regional instances' and 'Unified endpoint vs direct provider routes'; bold the key distinction (translates vs does not) - Fix cross-reference in manage-prompts-programmatically.mdx to new anchor
Replace abstract bullet points with a table using the concrete base URL from the regional instances section, showing the full URL for each endpoint style (unified /v1/chat/completions, /v1/messages, /v1/responses, and direct provider route with no suffix). Keeps format translation distinction bolded.
- 'lowest-priority routing signal' -> 'More specific settings take priority over' - Remove em-dashes from table cells; 'Yes — always' -> 'Yes, always' - '— (this is the gateway setting)' -> 'This is the gateway setting' - 'takes precedence over' -> 'takes priority over' - 'when the gateway URL is in use' -> 'when the gateway is in use' - 'unexpected routing' -> 'unexpected behavior'
- Tighten opening sentence; move 'no per-client wiring' to second clause - Remove bold on 'chat model' (redundant with the Note below) - Warning: shorten 'a doubled path and request failures' -> 'doubles the path and causes failures' - Merge two Notes into one (chat-models-only + LANGSMITH_GATEWAY_API_KEY) - Override table: rename 'Overrides gateway?' column to 'Priority'; use Highest/Higher/Base instead of Yes/Yes/'This is the gateway setting' - Remove TypeScript edge-case Note (vague; better to just test)
- Override precedence: replace two-column table with a numbered list (1 = highest priority, 3 = base) — self-evident without a column header - Add parallel numbered-list sentence for API key precedence - Move LANGSMITH_GATEWAY_API_KEY guidance out of Note bubble into plain prose - Opening sentence: 'no per-client base_url or api_key wiring needed' -> 'Each integration picks up the gateway automatically from the environment'
added 2 commits
September 11, 2026 20:39
Split Python and TypeScript into separate tabs so each table only shows the env vars for that language — no more mixed column headers. Both tables show Base URL and API key settings side by side with 1/2/3 priority rows.
- Collapse 3 unified /v1 rows into one: URL is /v1, description explains it accepts all 3 formats and translates between them - Direct provider route: add concrete Anthropic example showing the full URL the SDK hits, so readers understand what 'SDK appends its own path' means - Rename 'Style' column to 'Endpoint'
mcintoshjames-sketch
pushed a commit
to mcintoshjames-sketch/docs
that referenced
this pull request
Sep 13, 2026
## Overview Adds a new "Forked subagents" section documenting `mode: "fork"` on a `SubAgent`, which inherits the parent's full conversation history and mirrors the parent's prompt-producing middleware instead of starting from just the delegated task description. This feature previously had zero documentation in either language. The section is added to the existing `subagents.mdx` page both Python and JS. ## Type of change **Type:** New section on `subagents.mdx` ## Related issues/PRs - Feature PR: langchain-ai/deepagents#5714 (Python implementation, now includes the langchain-ai#5981 middleware-mirroring rework and langchain-ai#6016, which dropped the separate `ForkedSubAgent` type in favor of `mode: "fork"` on `SubAgent`), langchain-ai/deepagentsjs#810 (JS port) ## Checklist - [x] I have read the [contributing guidelines](README.md), including the [language policy](https://docs.langchain.com/oss/python/contributing/overview#language-policy) - [x] I have tested my changes locally using `docs dev` - [x] All code examples have been tested and work correctly - [x] I have used **root relative** paths for internal links - [x] I have updated navigation in `src/docs.json` if needed ## Additional notes - No `deepagents>=X.Y` line yet (source PR still open); will update once we release. - This PR can't pass CI (or be correct) until deepagents#5714 merges and a new PyPI release goes out. --------- Co-authored-by: Naomi Pentrel <5212232+npentrel@users.noreply.github.com>
The LLM Gateway overview and quickstart were both trying to be the first request, and the quickstart had grown to 307 lines by accumulating reference material below its tabs. Split the two jobs apart. - llm-gateway.mdx becomes the quickstart, on the existing (most-linked) URL. Three <Steps>: send a request, view the trace, set a spend limit. Beta moves from a <Note> to the frontmatter tag, and Prerequisites folds into one <Info>, so the first code block sits above the fold. - Drop the Messages and Responses tabs. Both duplicated llm-gateway-api-formats, which already documents all three formats in cURL, Python, and TypeScript. - New llm-gateway-how-it-works.mdx holds the request pipeline, the credential-management table, and availability. - New llm-gateway-langchain.mdx owns LANGSMITH_GATEWAY, supported integrations, and override precedence, which had diverged between the quickstart and llm-gateway-direct-model-access. - Delete llm-gateway-quickstart.mdx, redirect it, and repoint inbound links. Precedence and routing verified against langchain_core/utils/_gateway.py, langchain/chat_models/base.py, and the langchainjs equivalents. Two corrections: the API key rule depends on where the base URL came from, not a flat ordering, and @langchain/google-genai supports the gateway from 2.3.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Anthropic's model overview lists Claude Sonnet 4.6 under legacy models. The current lineup is Fable 5.1, Opus 5, Sonnet 5, and Haiku 4.5, and Anthropic recommends starting with Opus 5 for most workloads. Scoped to the two pages this branch adds. The rest of the gateway set still carries claude-sonnet-4-6. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Anthropic lists Claude Sonnet 4.6 under legacy models. Updates the remaining 16 illustrative references across the gateway set so the examples agree with the quickstart. All 16 are illustrative model IDs, not deliberate references to an older model. The models-list response on the API formats page already used claude-opus-5, so no duplicate entry is introduced. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The frontmatter tag alone is easy to miss on the landing page. Adds the one-line Note that the other 13 gateway pages already carry, verbatim, to the quickstart and the two new pages. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The tabs explained what each one does but not how to choose between them. Adds two sentences inside the first step: what a gateway call is, then when to reach for Chat completions versus Deep Agents. Step titles left as short imperative phrases, matching the ~512 other <Step title> values in the corpus. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Matches the 12 sibling gateway pages that put the note directly after the frontmatter. The previous placement followed llm-gateway-api-formats, which is the one page in the set that does it the other way. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The note was duplicated inline on 16 pages, so the wording will need 16 edits when the gateway reaches GA. Extracts it to snippets/langsmith/llm-gateway-beta-note.mdx and imports it everywhere, following the Managed Deep Agents pattern. Also: - Adds the note to llm-gateway-monitoring.mdx, the one page in the set that was missing it. - Drops the redundant "**Beta:**" prefix; the note now reads "The LLM Gateway is in beta." - Normalizes placement on llm-gateway-api-formats.mdx, which had the note below the intro. - Removes the page-level `tag: "Beta"` frontmatter added earlier, since no other page in the set uses it and the nav item already carries one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Three hand-authored miscasings of the product name. Capitalization only, so the #use-with-the-langsmith-gateway heading anchor is unchanged and its inbound link still resolves. Leaves alone the uses that are correctly lowercase: "an LLM gateway" as a generic category noun (the auth-proxy page, third-party provider listings, the quickstart's own example prompt) and the Kubernetes Gateway resource on the self-hosted pages. Does not touch changelog.mdx or self-hosted-changelog.mdx, which carry 36 more instances. Both are generated (changelog-weekly from langchainplus fragments, self-hosted by the helm bot) and published to RSS, so the fix belongs upstream in the fragment source. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Mintlify preview branch generated: Site preview: https://langchain-5e9cc07a-preview-docsst-1789404613-ca6eea6.mintlify.site Important Preview links may take a few minutes to start working while the deployment finishes. Changed documentation pages (preview deep links):
Only the top 5 changed markdown files by diff size are listed. |
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.
Fixes DOC-1614
Summary
init_chat_modelcreate_deep_agentcode block into its proper Deep Agents (Python) tab alongside theLANGSMITH_GATEWAY="true"setup stepLANGSMITH_GATEWAYenv var resolution tables into named accordions at the bottom of the page (separate for LangChain Python and TypeScript) so they're available for reference but don't interrupt the quickstart flowLANGSMITH_API_KEYlisted first, regional/BYOC note collapsed into a single<Note>Links
Verification
No runnable code changed. Docs-only copy and structure change.
Reviewers
Requested review from: Kathryn May (@katmayb), Florence Morris (@fjmorris)