Skip to main content

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

  1. Go to Hub > Models Hub and filter by type to find a chat model that fits your needs.
  2. 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 model parameter)

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

  1. Run the application and confirm you receive normal responses.
  2. 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_url and model name once more