Switch an Existing OpenAI App to a Platform Endpoint
Goal: switch an application that calls the OpenAI API over to a platform model endpoint without changing the application architecture — only two configuration values change.
Cost: billed by token usage for the chosen model; see the Pricing section of each model in the Models Hub for unit prices.
Prerequisites
- You have an account with available credits
- You have created an API key
- Your existing application uses the OpenAI SDK (Python or JavaScript) or calls the API directly over HTTP
Step 1: Pick a matching model
- Go to Hub > Models Hub and filter by type to find a chat model that fits your needs.
- We recommend trying it in the Playground first to confirm the response quality and parameter settings meet your expectations.
Step 2: Get connection details
On the model details page, click API Endpoint; the panel shows the API path and code samples. Note down:
- API path (used as
base_url) - Model name (used as the
modelparameter)
Step 3: Update your application settings
Using the Python OpenAI SDK as an example, only the client initialization changes:
from openai import OpenAI
# Before: client = OpenAI(api_key="sk-...")
client = OpenAI(
base_url="<API path from Step 2>",
api_key="<your platform API key>",
)
# On the call side, only the model name changes; the rest of the code stays the same
response = client.chat.completions.create(
model="<model name from Step 2>",
messages=[{"role": "user", "content": "Hello!"}],
)
We recommend putting base_url, api_key, and model in environment variables so you can switch between environments easily.
Step 4: Verify
- Run the application and confirm you receive normal responses.
- Go to Management > Usage > Model Inference Usage and confirm the call records and amounts are as expected.
Cost control
Set a budget limit on the API key dedicated to this application; requests are rejected once the limit is exceeded, so abnormal traffic cannot burn through your budget.
Next steps
- When traffic grows and you need dedicated resources, switch to a private endpoint — the calling pattern stays the same; you only swap the
base_urland model name once more