Quickstart: Call Your First Model API
This page walks you through your first model inference call in 5 minutes. The platform's public endpoints are compatible with the OpenAI API — if you have used the OpenAI SDK before, there is almost nothing new to learn.
Prerequisites
- You have signed up and logged in to the Dev Console
- Your account has available credits (see Top Up and Payments for how to top up)
Step 1: Create an API key
- Go to Management > Keys.
- Click Add API Key and enter a key name; optionally set a Budget Limit.
- After clicking Create, copy the key immediately and store it safely.
caution
Once you close the creation panel, the full key can no longer be viewed. If you lose it, create a new key.
Step 2: Pick a model
- Go to Hub > Models Hub to browse all published models. You can filter by type or search by name and provider.
- Click a model card to view its Pricing and model information.
- Click API Endpoint; the panel shows code samples in Python, JavaScript, and cURL, along with the API path.
Step 3: Send your first request
Copy the code sample from the panel and replace your-api-key-here with the API key you created in Step 1. Using Python as an example:
from openai import OpenAI
client = OpenAI(
base_url="<API path shown in the panel>",
api_key="your-api-key-here", # replace with your API key
)
response = client.chat.completions.create(
model="<model name shown in the panel>",
messages=[{"role": "user", "content": "Introduce yourself in one sentence"}],
)
print(response.choices[0].message.content)
Once you run it and receive a reply from the model, you are done. Charges are based on token usage; you can review every call record at any time under Management > Usage.
Next steps
- Want to test interactively before writing code? Try the model in the Playground
- Need dedicated resources and more consistent latency? Deploy a private endpoint
- Learn the details of the OpenAI-compatible API