Skip to content

fix(backend): wire THUNDERBOLT_INFERENCE_URL through the inference proxy - #1203

Open
njbrake wants to merge 1 commit into
thunderbird:mainfrom
njbrake:pr4-wire-inference-gateway
Open

fix(backend): wire THUNDERBOLT_INFERENCE_URL through the inference proxy#1203
njbrake wants to merge 1 commit into
thunderbird:mainfrom
njbrake:pr4-wire-inference-gateway

Conversation

@njbrake

@njbrake njbrake commented Aug 6, 2026

Copy link
Copy Markdown

Note: this PR description was drafted by Claude via back-and-forth with @njbrake. The reasoning and decisions are his; the prose is Claude's.

Makes THUNDERBOLT_INFERENCE_URL work. It is documented in docs/self-hosting/configuration.md as the way to point a self-hosted backend at an OpenAI-compatible gateway, but nothing read it: the variable was absent from settings.ts and from the inference client, so setting it had no effect.

Adds the setting, a thunderbolt-inference provider in the inference client, and routing in inference/routes.ts for model ids the built-in table does not cover.

Models are discovered from the endpoint's GET /models rather than listed by hand, so a gateway that gains a model needs no redeploy. Discovery is cached for five minutes and refreshed when the app fetches /config. If the endpoint is unreachable its models are omitted and the built-ins keep working, so a gateway outage cannot break boot.

THUNDERBOLT_INFERENCE_MODELS stays optional and now does two things when set: restricts which discovered models are exposed, and supplies display names.

Requests are proxied through the backend, so the gateway key stays server side and the gateway needs no CORS configuration. Capabilities are advertised conservatively because the endpoint cannot be introspected.

Verified against a live gateway: 16 discovered models, and server logs confirming provider="thunderbolt-inference" with a 200 on a real completion.

_Note: this PR description was drafted by Claude via back-and-forth with @njbrake. The reasoning and decisions are his; the prose is Claude's._

Makes `THUNDERBOLT_INFERENCE_URL` work. It is documented in `docs/self-hosting/configuration.md` as the way to point a self-hosted backend at an OpenAI-compatible gateway, but nothing read it: the variable was absent from `settings.ts` and from the inference client, so setting it had no effect.

Adds the setting, a `thunderbolt-inference` provider in the inference client, and routing in `inference/routes.ts` for model ids the built-in table does not cover.

Models are **discovered** from the endpoint's `GET /models` rather than listed by hand, so a gateway that gains a model needs no redeploy. Discovery is cached for five minutes and refreshed when the app fetches `/config`. If the endpoint is unreachable its models are omitted and the built-ins keep working, so a gateway outage cannot break boot.

`THUNDERBOLT_INFERENCE_MODELS` stays optional and now does two things when set: restricts which discovered models are exposed, and supplies display names.

Requests are proxied through the backend, so the gateway key stays server side and the gateway needs no CORS configuration. Capabilities are advertised conservatively because the endpoint cannot be introspected.

Verified against a live gateway: 16 discovered models, and server logs confirming `provider="thunderbolt-inference"` with a 200 on a real completion.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@njbrake
njbrake deployed to fork-preview-approval August 6, 2026 22:23 — with GitHub Actions Active
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Preview environment deployed 🚀

Service URL
Marketing / blog / docs https://thunderbolt-pr-1203.preview.thunderbolt.io
App https://app-pr-1203.preview.thunderbolt.io
API https://api-pr-1203.preview.thunderbolt.io
Keycloak https://auth-pr-1203.preview.thunderbolt.io
PowerSync https://powersync-pr-1203.preview.thunderbolt.io

Stack: preview-pr-1203 · Commit: 875e4d7cd73ab096450e9865ab3c1f52d49715d5

Auto-destroys on PR close/merge. Login via the bundled Keycloak realm — demo@thunderbolt.io / demo by default.

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