Skip to main content
PipeShift provides an OpenAI-compatible chat completions API for open-source and custom models. Use Custom Endpoints in the AI Gateway to register PipeShift once, keep the PipeShift API key on the gateway, and let your applications call models through a single TrueFoundry API key with access control and tracing.

Prerequisites

1

Create a PipeShift account

Sign up at pipeshift.com if you do not already have an account.
2

Generate a PipeShift API key

In the PipeShift dashboard, create an API key for your workspace.Store the key securely. You will paste it into the 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 gateway. See Gateway base URL and Authentication.

Adding models

Add PipeShift to the AI Gateway using Custom Endpoints.
1

Create a Custom Endpoint provider account

In the TrueFoundry dashboard, go to AI GatewayModelsCustom Endpoints and click Add Custom Endpoint.In Configure Account, set:
  • Name (Account Name): any unique label for this provider (for example, pipeshift) — this is your provider account name and appears as the first path segment in every request URL ({providerAccountName})
  • Endpoint Type: None
  • Header Auth: keep disabled
2

Add a PipeShift endpoint

On the Endpoints step, add an integration and configure:
  • Display Name: any unique label for this endpoint (for example, model) — this is your custom endpoint display name and appears as the second path segment in every request URL ({endpointName})
  • Base URL: https://api.pipeshift.com/api
Enable Custom Headers and add:
  • Content-Type: application/json
  • Authorization: Bearer <PIPSHIFT_API_KEY>
Keep Header Auth and TLS Settings disabled unless your deployment requires them.
Custom Endpoint form for PipeShift with Base URL and custom headers
The Authorization header here is sent from the gateway to PipeShift. Your application should only send the TrueFoundry API key to the gateway.
You can click + Add Custom Endpoint to register multiple endpoints under the same account (for example, model, vision, or fast-inference). Each gets its own Display Name in the URL, but they can all point to the same PipeShift Base URL and headers. Which PipeShift 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 provider 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)

Inference

Once saved, call PipeShift through the gateway’s proxy-api path. URL shape and path rules are documented under Custom Endpoints.

How the request URL is built

The gateway URL has two values you configure in the dashboard — they are not PipeShift model IDs:
URL segmentDashboard fieldExample in this guide
{providerAccountName}Account Name (Configure Account → Name)pipeshift
{endpointName}Custom endpoint Display Name (Endpoints step)model
Full URL pattern:
{GATEWAY_BASE_URL}/proxy-api/{providerAccountName}/{endpointName}/v0/chat/completions
With the example configuration above:
{GATEWAY_BASE_URL}/proxy-api/pipeshift/model/v0/chat/completions
SegmentExample valueMeaning
{GATEWAY_BASE_URL}https://internal.devtest.truefoundry.tech/api/llmYour AI Gateway base URL
pipeshiftAccount Name you set in Configure Account{providerAccountName}
modelDisplay Name you set for the custom endpoint{endpointName}
v0/chat/completionsUpstream pathAppended to the integration Base URL
The gateway forwards the request to:
https://api.pipeshift.com/api/v0/chat/completions

Choosing a PipeShift model

PipeShift hosts many models available in your workspace. You do not need a separate custom endpoint per model — set the model field in the JSON request body to whichever PipeShift model ID you want to run (for example, zai-org/GLM-5). 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 PipeShift model via the request body.
Replace pipeshift and model in the URL with your own Account Name and Display Name if you used different values during setup.

Supported APIs

APIEndpointTracingCost Tracking
Chat Completions/proxy-api/{providerAccountName}/{endpointName}/v0/chat/completions
Before you start: Replace {GATEWAY_BASE_URL} with your gateway base URL (how to find it) and set TFY_API_KEY to your TrueFoundry API key.

Request headers (client → gateway)

HeaderValue
AuthorizationBearer <TFY_API_KEY>
Content-Typeapplication/json
Accept-Encodingidentity

Python (requests)

import os

import requests

GATEWAY_BASE_URL = "{GATEWAY_BASE_URL}"  # e.g. https://internal.devtest.truefoundry.tech/api/llm
TFY_API_KEY = os.environ.get("TFY_API_KEY", "your-tfy-api-key")

# providerAccountName = Account Name from Configure Account (e.g. pipeshift)
# endpointName = Custom endpoint Display Name (e.g. model)
# model in BODY = PipeShift model ID (e.g. zai-org/GLM-5)
PROVIDER_ACCOUNT_NAME = "pipeshift"
ENDPOINT_NAME = "model"
URL = f"{GATEWAY_BASE_URL}/proxy-api/{PROVIDER_ACCOUNT_NAME}/{ENDPOINT_NAME}/v0/chat/completions"

HEADERS = {
    "Authorization": f"Bearer {TFY_API_KEY}",
    "Content-Type": "application/json",
    "Accept-Encoding": "identity",
}

BODY = {
    "model": "zai-org/GLM-5",  # any PipeShift 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,
}

response = requests.post(URL, headers=HEADERS, json=BODY, timeout=120)
response.raise_for_status()

print(response.json())

cURL

curl -X POST "{GATEWAY_BASE_URL}/proxy-api/pipeshift/model/v0/chat/completions" \
  -H "Authorization: Bearer $TFY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept-Encoding: identity" \
  -d '{
    "model": "zai-org/GLM-5",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Tell me about Truefoundry AI Gateway"}
    ],
    "temperature": 0.7,
    "stream": false
  }'

OpenAI Python SDK

Because PipeShift is OpenAI-compatible, you can point the OpenAI SDK at the gateway proxy path instead of PipeShift directly:
import os

from openai import OpenAI

GATEWAY_BASE_URL = "{GATEWAY_BASE_URL}"  # e.g. https://internal.devtest.truefoundry.tech/api/llm
TFY_API_KEY = os.environ.get("TFY_API_KEY", "your-tfy-api-key")

PROVIDER_ACCOUNT_NAME = "pipeshift"  # Account Name
ENDPOINT_NAME = "model"             # Custom endpoint Display Name

client = OpenAI(
    api_key=TFY_API_KEY,
    base_url=f"{GATEWAY_BASE_URL}/proxy-api/{PROVIDER_ACCOUNT_NAME}/{ENDPOINT_NAME}/v0",
)

response = client.chat.completions.create(
    model="zai-org/GLM-5",  # any PipeShift 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 PipeShift. For gateway limitations on Custom Endpoints (HTTPS, streaming, and so on), see Custom Endpoints.