Add and configure SCX.ai models in TrueFoundry’s AI Gateway using Custom Endpoints.
SCX.ai provides an OpenAI-compatible chat completions API for open-source models. Use Custom Endpoints in the AI Gateway to register SCX.ai once, keep the SCX.ai API key on the AI Gateway, and let your applications call models through a single TrueFoundry API key with access control and tracing.
Sign up at platform.scx.ai if you do not already have an account.
2
Generate an SCX.ai API key
In the SCX.ai platform, create an API key.Store the key securely. You will paste it into the AI Gateway’s Custom Headers configuration — not in client application code.
3
Get your TrueFoundry API key and gateway URL
You need a TrueFoundry API key (TFY_API_KEY) and your gateway base URL to call models through the AI Gateway. See Gateway base URL and Authentication.
Add SCX.ai to the AI Gateway using Custom Endpoints.
1
Create a Custom Endpoint model account
In the TrueFoundry dashboard, go to AI Gateway → Models → Custom Endpoints and click Add Custom Endpoint.In Configure Account, set:
Name (Account Name): any unique label for this provider (for example, scx) — this is your model account name and appears as the first path segment in every request URL ({providerAccountName})
Endpoint Type: None
Header Auth: keep disabled
2
Add an SCX.ai endpoint
On the Endpoints step, add an integration and configure:
Display Name: any unique label for this endpoint (for example, inference) — this is your custom endpoint display name and appears as the second path segment in every request URL ({endpointName})
Base URL: https://api.scx.ai
Enable Custom Headers and add:
Authorization: Bearer <SCX_API_KEY>
Keep Header Auth and TLS Settings disabled unless your deployment requires them.
Endpoint settings — Base URL and upstream headers
The Authorization header here is sent from the AI Gateway to SCX.ai. Your application should only send the TrueFoundry API key to the AI Gateway.
You can click + Add Custom Endpoint to register multiple endpoints under the same account (for example, inference, vision, or fast-inference). Each gets its own Display Name in the URL, but they can all point to the same SCX.ai Base URL and headers. Which SCX.ai model runs is chosen in the request body model field — not by the display name.
3
Set access control and save
On the Access Control step, choose who can manage and use this model account, then Save.
Manager: users/teams who can edit or delete the custom endpoint
User: users/teams who can call the endpoint (for example, everyone)
SCX.ai hosts many models. You do not need a separate custom endpoint per model — set the model field in the JSON request body to whichever SCX.ai model ID you want to run (for example, Meta-Llama-3.3-70B-Instruct).If you add multiple custom endpoints under the same account (different Display Name values), use the matching {endpointName} in the URL; each endpoint can still call any SCX.ai model via the request body.
Replace scx and inference in the URL with your own Account Name and Display Name if you used different values during setup.
Because SCX.ai is OpenAI-compatible, you can point the OpenAI SDK at the AI Gateway proxy path instead of SCX.ai directly:
import osfrom openai import OpenAIGATEWAY_BASE_URL = "{GATEWAY_BASE_URL}" # e.g. https://internal.devtest.truefoundry.tech/api/llmTFY_API_KEY = os.environ.get("TFY_API_KEY", "your-tfy-api-key")PROVIDER_ACCOUNT_NAME = "scx" # Account NameENDPOINT_NAME = "inference" # Custom endpoint Display Nameclient = OpenAI( api_key=TFY_API_KEY, base_url=f"{GATEWAY_BASE_URL}/proxy-api/{PROVIDER_ACCOUNT_NAME}/{ENDPOINT_NAME}/v1",)response = client.chat.completions.create( model="Meta-Llama-3.3-70B-Instruct", # any SCX.ai model ID messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Tell me about TrueFoundry AI Gateway"}, ], temperature=0.7, stream=False,)print(response.choices[0].message.content)
Support scope: Custom Endpoints proxy requests transparently to SCX.ai. For gateway limitations on Custom Endpoints (HTTPS, streaming, and so on), see Custom Endpoints.
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.