Your first request
Copy your Base URL and key from the console, then call with curl / Python / Node.js in minutes.
This guide walks you through your first API call from scratch. Before starting, make sure:
- You have created an API key and saved the full key.
- You have the Base URL: sign in to the console, open the "Quick start" dialog, pick a protocol and copy it. The examples below use
https://<your-base-url>as a placeholder — replace it with your own.
The platform speaks three native protocols; pick whichever fits — billing and balance are identical across all of them.
OpenAI-compatible protocol (default recommendation)
Fully compatible with the OpenAI SDK: point base_url at the platform and your existing code keeps working.
cURL
curl https://<your-base-url>/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model",
"messages": [{"role": "user", "content": "Hello"}]
}'
Python (openai SDK)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://<your-base-url>",
)
completion = client.chat.completions.create(
model="your-model",
messages=[{"role": "user", "content": "Hello"}],
)
print(completion.choices[0].message.content)
Node.js (openai SDK)
import OpenAI from "openai"
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://<your-base-url>",
})
const completion = await client.chat.completions.create({
model: "your-model",
messages: [{ role: "user", content: "Hello" }],
})
console.log(completion.choices[0].message.content)
Anthropic protocol
Isomorphic to the Anthropic Messages API: authenticate with x-api-key and carry anthropic-version:
curl https://<your-base-url>/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello"}]
}'
Gemini protocol
Isomorphic to the Google GenAI API: the model ID goes into the path, and authentication uses x-goog-api-key:
curl "https://<your-base-url>/v1beta/models/your-model:generateContent" \
-H "x-goog-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"parts": [{"text": "Hello"}]}]
}'
Verify the result
A successful request returns the model's reply (for the OpenAI protocol it is in choices[0].message.content). From there you can:
- Check the usage and balance change on the "Usage" page in the console;
- Replace
your-modelwith a real model ID from the model marketplace (text, image, audio, video, and file modalities are supported).
Common first-call errors
| Symptom | Cause and fix |
|---|---|
| 401 Unauthorized | Wrong key, or the key was deleted / expired. Check that you are using the full key saved at creation, with no stray whitespace |
| Model not found | The model ID is misspelled. Copy the exact ID from the model marketplace |
| Insufficient balance | Top up first, then retry |
Production tips: keep the key in an environment variable (e.g.
OPENAI_API_KEY) instead of hard-coding it, and prefer the official SDK over hand-written HTTP calls — the SDK absorbs protocol compatibility details.

