OpenAI-Compatible API
The platform's model inference API is compatible with the OpenAI API. This means:
- Almost zero changes to existing code: just replace
base_urlandapi_keyto switch an application that calls OpenAI over to a platform endpoint. - Use the official OpenAI SDKs directly: existing toolchains in the Python and JavaScript ecosystems work as-is; no proprietary SDK to install.
- Public and private endpoints are called the same way: both follow the same API conventions; the only differences are the Base URL and model name.
Get connection details
Public endpoints: in Hub > Models Hub, click a model card and choose API Endpoint. The panel provides Python / JavaScript / cURL code samples and the API path.
Private endpoints: in Gen AI Studio > My Endpoints, click an endpoint. The Private API Information section under Details includes the Base URL, model name, endpoint type, and API path; click Show Code for a complete sample.
Example calls
Using a chat model as an example (use the Base URL and model name shown in the console panel):
from openai import OpenAI
client = OpenAI(
base_url="<API path shown in the console>",
api_key="your-api-key-here", # replace with your API key
)
response = client.chat.completions.create(
model="<model name shown in the console>",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is a GPU?"},
],
temperature=0.7,
)
print(response.choices[0].message.content)
curl <API path shown in the console> \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-here" \
-d '{
"model": "<model name shown in the console>",
"messages": [{"role": "user", "content": "What is a GPU?"}]
}'
tip
Parameters you tune in the Playground (such as Temperature) are reflected in the sample generated by View code — tune until you are happy, then copy. Easiest path.
Authentication and credits
- All requests are authenticated with an API key; keys can have a Budget Limit, and requests are rejected once the limit is reached.
- Public endpoints are billed by token usage and subject to rate limits; every call record can be found in the usage reports.