Skip to content

Support route_through_gateway, and warn that it is Cloud only - #16

Open
ericjohanson-langchain wants to merge 2 commits into
mainfrom
feat/gateway-routing-flag
Open

Support route_through_gateway, and warn that it is Cloud only#16
ericjohanson-langchain wants to merge 2 commits into
mainfrom
feat/gateway-routing-flag

Conversation

@ericjohanson-langchain

Copy link
Copy Markdown
Contributor

Missed the merge of #15 — pushed to that branch after it merged.

The control plane can route a deployment's OpenAI and Anthropic calls through
the LLM Gateway itself, so the deployment needs no provider key of its own. The
client had no way to set it. Adds --route-through-gateway.

The part worth reviewing

This field exists on Cloud's control plane and not on self-hosted. Setting
it against a self-hosted instance is accepted by the API and then silently
dropped — I only noticed because I read the value back afterwards and it was
still null.

So the CLI now warns when it is used with --target self-hosted, the help says
"Cloud only", and the docs spell out what each hosting model actually supports:

Cloud (SaaS) Self-Hosted
route_through_gateway supported silently ignored
Gateway with a forwarded key LLM_GATEWAY_API_KEY, or the injected LANGSMITH_API_KEY LLM_GATEWAY_API_KEY must be a Cloud key
Direct provider ANTHROPIC_API_KEY / OPENAI_API_KEY same

The gateway is a Cloud service, so a self-hosted instance's own API key gets a
403 from it. That is why LLM_GATEWAY_API_KEY exists separately, and why
there is no "the platform handles it" option on self-hosted.

76 tests, lint, actionlint and bandit green. Workflows are still disabled by
request, so CI will not run on this PR.

ericjohanson-langchain and others added 2 commits August 24, 2026 16:54
The control plane can route a deployment's OpenAI and Anthropic calls through
the LLM Gateway itself, so the deployment needs no provider key. The client had
no way to set it.

Add --route-through-gateway. Then the important part: this field exists on
Cloud's control plane and *not* on self-hosted. Setting it against a self-hosted
instance is accepted by the API and silently dropped -- I only noticed because I
read the value back afterwards and it was still null.

Warn when it is used with --target self-hosted, say "Cloud only" in the help,
and document what the two hosting models actually support. The gateway is a
Cloud service, so a self-hosted deployment must forward a Cloud key as
LLM_GATEWAY_API_KEY or use a provider key directly; its own instance key gets a
403 from the gateway.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Left behind while trimming that test; ruff caught it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant