Skip to main content
To call models through the TrueFoundry AI Gateway, you need three things:
  1. Gateway Base URL — the endpoint for the AI Gateway service
  2. Model ID — the identifier of the model you want to call
  3. API Key — a TrueFoundry authentication token (PAT or VAT)
All three are available in the Code Snippets tab of the Playground. Open the Playground, select a model, and click the Code button to see them pre-filled in a ready-to-use code snippet.
Gateway Code Snippets Page with code generation options
Playground header showing Base URL, Model ID, and API Key fields

Gateway Base URL

The Gateway Base URL is the single endpoint your application sends all LLM requests to. Instead of calling each provider (OpenAI, Anthropic, Azure, etc.) at their own endpoints, you point every request at this one URL. The Gateway routes it to the right provider behind the scenes.
DeploymentBase URL
TrueFoundry SaaShttps://gateway.truefoundry.ai
Self-hostedFound in the Code Snippets section of the Playground
The Gateway Base URL is compatible with the OpenAI API format, so any SDK or tool that supports the OpenAI API can work with TrueFoundry by simply changing the base URL.

Model ID

Every model accessible through the Gateway has a unique identifier in the format provider_account/model_name. For example, openai-main/gpt-4o-mini means the model gpt-4o-mini available through the provider account named openai-main. The provider account represents a configured connection to an LLM provider — your organization may have multiple accounts for the same provider (e.g., openai-main for production and openai-dev for testing). You can find available Model IDs in:

API Key (Authentication)

To access models through the AI Gateway, you authenticate with a TrueFoundry API key — not the original provider keys (OpenAI, Anthropic, etc.). The Gateway manages provider credentials centrally, so developers only need a single TrueFoundry token. TrueFoundry supports two types of API keys:
Token typeBest for
Personal Access Token (PAT)Development and testing
Virtual Account Token (VAT)Production applications
For detailed instructions on creating and managing tokens, see the Authentication documentation.

Getting Code Snippets from the Playground

The fastest way to start making requests is to copy a code snippet directly from the Playground. The generated snippets come pre-filled with the correct Base URL, Model ID, and your API key — so you can paste and run immediately.
  1. Open the Playground and select a model
  2. Click the Code button in the top bar
  3. Choose your language or framework
  4. Copy the generated code into your application
Available snippet formats: OpenAI SDK, Langchain, Langgraph, Google ADK, Stream API, Rest API, Go-OpenAI, Rust-OpenAI, cURL, Node.js, LlamaIndex, Langchain4j
Code snippet generation interface with language options