Support for TrueFoundry AI Gateway as model provider - #483
Merged
Conversation
🦋 Changeset detectedLatest commit: 08fc847 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
chiragjn
force-pushed
the
cj-truefoundry-ai-gateway-models
branch
from
August 27, 2026 21:36
f15030a to
dd10940
Compare
chiragjn
force-pushed
the
cj-truefoundry-ai-gateway-models
branch
3 times, most recently
from
August 31, 2026 12:40
8304e17 to
663fe55
Compare
thesujai
reviewed
Aug 31, 2026
Contributor
|
thesujai
marked this pull request as ready for review
September 1, 2026 07:01
thesujai
requested review from
bhaveshpatel640,
govindavashishtha,
heerambavi1998,
kumarsks619,
qaifi-tf,
sajal-truefoundry,
sayan-truefoundry,
sr07asthana and
vinit-truefoundry
as code owners
September 1, 2026 07:01
akashg3627
reviewed
Sep 1, 2026
thesujai
reviewed
Sep 1, 2026
debajyoti-truefoundry
approved these changes
Sep 1, 2026
thesujai
force-pushed
the
cj-truefoundry-ai-gateway-models
branch
from
September 1, 2026 17:17
a2c6b6e to
53dba13
Compare
thesujai
enabled auto-merge (squash)
September 1, 2026 17:18
Add TrueFoundry mode: models are sourced from the ServiceFoundry provider-integrations API and invoked through the TrueFoundry AI gateway, resolved per request from the caller's token. - Per-request model provider store: `resolveModelProviderStore(c?)` returns a token-bound TrueFoundry store when a request context is present, and the DB persistence store otherwise (e.g. the scheduler). - TrueFoundry provider manifest carries base_url + auth; auth is redacted from API responses and the store is the source of truth at runtime. - mTLS support for ServiceFoundry calls (TRUEFOUNDRY_MTLS_ENABLED / TRUEFOUNDRY_MTLS_CERTS_DIR); no caching of tokens, gateway URLs, or model properties; request timings are logged. - TrueFoundry-managed resources reject writes with a standardized 424; reads behave normally. Co-authored-by: Cursor <cursoragent@cursor.com>
thesujai
force-pushed
the
cj-truefoundry-ai-gateway-models
branch
from
September 1, 2026 17:32
58b98df to
08fc847
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 08fc847. Configure here.
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.

Summary
Support for TrueFoundry AI Gateway as model provider
How was this tested?
Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changedNote
High Risk
Changes authentication (per-caller gateway tokens, OIDC mutual exclusion), routes all model listing and inference through external ServiceFoundry/Gateway, and passes caller tokens into LLM config—security- and availability-sensitive paths.
Overview
Adds TrueFoundry mode when
TRUEFOUNDRY_SERVICEFOUNDRY_SERVER_URLis set: chat models are discovered from the ServiceFoundry server (caller Bearer/access cookie) and LLM calls go to the tenant’s default AI Gateway using that token. Startup rejects enabling OIDC alongside this mode.Introduces a read-only
truefoundrymodel provider (TrueFoundryModelProviderStore+TrueFoundryServiceFoundryServerClient), optional internal mTLS (TRUEFOUNDRY_MTLS_ENABLED/TRUEFOUNDRY_MTLS_CERTS_DIR), andresolveModelProviderStore(c)so HTTP handlers get a token-bound store while background jobs keep the DB store. Settings create/replace model provider returns 424 when resources are TrueFoundry-managed; OpenAPI/SDK gainTrueFoundryModelProvider, 401 on list models / create turn, and 424 on provider writes.VercelAILLMtreatstruefoundrylike other OpenAI-compatible providers (requiresbaseUrl). Auth middleware addsrequireAccessTokenandaccessTokencookie reading; optionalACCESS_LOGSrequest logging. UI catalog typing excludestruefoundryfrom user-savable presets.Reviewed by Cursor Bugbot for commit 08fc847. Bugbot is set up for automated code reviews on this repo. Configure here.