TrueFoundry
TrueFoundry AI Gateway sits between your applications and model providers and adds access control and request tracing. You register SCX.ai once as a Custom Endpoint. After that, the gateway holds your SCX.ai API key and your applications only need a TrueFoundry key.
If you don't need a gateway, call the API directly. See OpenAI compatibility.
Prerequisites
- A SCX.ai API key. Create one in the dashboard under API Keys. Use a dedicated key, named something like
truefoundry. Every request through the gateway is billed and logged against this one key, so a separate key keeps that traffic easy to find. - TrueFoundry AI Gateway access. You need permission to add Custom Endpoints, a TrueFoundry API key (
TFY_API_KEY), and your gateway base URL. The base URL is shown in the Code Snippet tab of the TrueFoundry Playground.
Add SCX.ai as a Custom Endpoint
Create a provider account
In TrueFoundry, go to AI Gateway → Models → Custom Endpoints → Add Custom Endpoint. Under Configure Account, set:
- Name:
scx. This becomes{providerAccountName}, the first segment of the URL you call. - Endpoint Type:
None - Header Auth: leave disabled.
Add the SCX.ai endpoint
On the Endpoints step, set:
- Display Name:
inference. This becomes{endpointName}, the second segment of the URL. - Base URL:
https://api.scx.ai - Custom Headers: enable, and add
Authorization:Bearer your-scx-api-key - Header Auth and TLS Settings: leave off.
Don't add /v1 or a trailing slash to the Base URL. The gateway appends the path from each request to it.
The Authorization header is sent by the gateway to SCX.ai. Your applications send only their TrueFoundry key. Use Authorization rather than x-api-key: SCX.ai checks Authorization first, so an x-api-key header is ignored whenever a bearer token is also present.
You need only one endpoint. The model field in each request chooses the model, so a single inference endpoint covers every model on your account.
Set access and save
Under Access Control, set:
- Manager: the users or teams who can edit or delete the endpoint.
- User: the users or teams who can call it (for example
everyone).
Click Save.
Call SCX.ai through the gateway
Requests go through the gateway's proxy-api path:
{GATEWAY_BASE_URL}/proxy-api/{providerAccountName}/{endpointName}/v1/chat/completions
{GATEWAY_BASE_URL}/proxy-api/{providerAccountName}/{endpointName}/v1/chat/completions
| Segment | Where it comes from | Example |
|---|---|---|
{GATEWAY_BASE_URL} | Your TrueFoundry gateway | https://gateway.truefoundry.ai (TrueFoundry SaaS; self-hosted gateways differ) |
{providerAccountName} | Provider account Name | scx |
{endpointName} | Endpoint Display Name | inference |
v1/chat/completions | Upstream path | Appended to the Base URL |
With the values above, the gateway forwards {GATEWAY_BASE_URL}/proxy-api/scx/inference/v1/chat/completions to https://api.scx.ai/v1/chat/completions. If you chose a different Name or Display Name, use yours in place of scx and inference.
Authenticate to the gateway with your TrueFoundry key, not your SCX.ai key.
curl -sS "$TFY_GATEWAY_BASE_URL/proxy-api/scx/inference/v1/chat/completions" \
-H "Authorization: Bearer $TFY_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept-Encoding: identity" \
-d '{
"model": "MiniMax-M3",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hi."}
]
}'
curl -sS "$TFY_GATEWAY_BASE_URL/proxy-api/scx/inference/v1/chat/completions" \
-H "Authorization: Bearer $TFY_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept-Encoding: identity" \
-d '{
"model": "MiniMax-M3",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hi."}
]
}'
MiniMax-M3 is an example. Use any chat model on your account. Browse the catalogue.
Supported APIs
| API | Endpoint | Tracing in TrueFoundry | Cost tracking in TrueFoundry |
|---|---|---|---|
| Chat completions | /proxy-api/{providerAccountName}/{endpointName}/v1/chat/completions | Yes | Not listed |
The gateway is a transparent proxy: it forwards the method, path, query string, headers and body unchanged, so other paths under /v1 reach SCX.ai too. Only chat completions is on TrueFoundry's supported list, though, so test any other endpoint before you rely on it.
TrueFoundry traces every Custom Endpoint request, and you can browse them in its Request Logging view. It doesn't list cost tracking for this integration, but SCX.ai tracks it: every request appears in your SCX.ai usage and request logs under the API key you added in step 2.
Limitations
- TrueFoundry documents and tests this integration with non-streaming requests only (
"stream": false). Streaming through a Custom Endpoint isn't documented, so don't rely on it. If you need streamed tokens, call SCX.ai directly athttps://api.scx.ai/v1. - TrueFoundry doesn't list cost tracking for this integration. Use your SCX.ai dashboard for spend.
- The gateway doesn't translate payloads. Requests and responses use the SCX.ai API format unchanged, so the parameters and limits in Endpoints & limits apply.
Troubleshooting
- 401 from SCX.ai. The key in the endpoint's
Authorizationcustom header is missing or invalid. Check that the value isBearerfollowed by the key, with a space. - The gateway rejects the request. The caller's
TFY_API_KEYis invalid, or the caller isn't a User in the endpoint's Access Control. Use a TrueFoundry key here, not a SCX.ai key. - 404 Not Found. The Base URL most likely ends in
/v1, so the forwarded path becomes/v1/v1/…. Set it tohttps://api.scx.ai. - 429 Too Many Requests. Every gateway caller shares the one SCX.ai key, and with it that key's rate and spend limits. See Endpoints & limits.
Next steps
- OpenAI compatibility: the parameters SCX.ai accepts on chat completions.
- TrueFoundry Custom Endpoints: URL structure, naming rules, load balancing, and tracing.