API Quickstart and integration guide

Use one API Key for text, images, and video. Examples below use this website as the API endpoint.

Authentication and models

Create and save a Key in the console, then send it in the Authorization: Bearer header. Keep the key on your server.

Replace MODEL_ID with a published model ID. Supported protocols, duration, resolution, and prices depend on that model.

OpenAI SDK
base_url = "https://www.lvzhouai.cc/v1"

Text

POST /v1/chat/completions

bash
curl 'https://www.lvzhouai.cc/v1/chat/completions' \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6-luna",
"messages": [
{
"role": "user",
"content": "Hello"
}
],
"max_tokens": 64
}'

Images

POST /v1/images/tasks

bash
curl 'https://www.lvzhouai.cc/v1/images/tasks' \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: YOUR_UNIQUE_REQUEST_ID" \
-d '{
"model": "gpt-image-2",
"prompt": "A blue ceramic cup on a wooden table",
"resolution": "1K"
}'

Video

POST /v1/videos/tasks

bash
curl 'https://www.lvzhouai.cc/v1/videos/tasks' \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: YOUR_UNIQUE_REQUEST_ID" \
-d '{
"model": "grok-imagine-video-1.5",
"prompt": "A slow camera movement through a garden",
"resolution": "480p",
"duration": 8
}'

Python and Node.js Quickstart

Set API_STATION_KEY in your server environment. These examples use the same text endpoint as curl.

Python 3
import json, os
from urllib.request import Request, urlopen

request = Request(
"https://www.lvzhouai.cc/v1/chat/completions",
data=json.dumps({"model": "gpt-6-luna", "messages": [{"role": "user", "content": "Hello"}], "max_tokens": 64}).encode(),
headers={"Authorization": "Bearer " + os.environ["API_STATION_KEY"], "Content-Type": "application/json"},
)
with urlopen(request, timeout=60) as response:
print(json.load(response)["choices"][0]["message"]["content"])
Node.js 20+
const response = await fetch("https://www.lvzhouai.cc/v1/chat/completions", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.API_STATION_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "gpt-6-luna",
messages: [{ role: "user", content: "Hello" }],
max_tokens: 64,
}),
});
const result = await response.json();
if (!response.ok) throw new Error(result.error?.message || "Request failed");
console.log(result.choices[0].message.content);

Models, specifications and billing units

Text rates are shown per one million input or output tokens. Images are billed per image, and video rates per generated second. The model and specification determine the rate; check the live catalog before submitting.

The examples use published specifications: gpt-image-2 at 1K, and grok-imagine-video-1.5 at 480p for 8 seconds. Do not assume other sizes, durations, tools or media inputs are supported.

You can list models available to your key with GET /v1/models. The public model catalog shows specifications and prices; key permissions may restrict the list.

bash
curl 'https://www.lvzhouai.cc/v1/models' \
-H "Authorization: Bearer YOUR_API_KEY"

A media task returns HTTP 201 with id, state and billing_state. Poll GET /v1/tasks/{id} with the same API Key. Treat succeeded as a generation result and settled as a separate billing result. If submission is uncertain, keep the same Idempotency-Key and input.

Task status and results

For each image or video operation, choose a unique 16–128 character Idempotency-Key. Retry an uncertain submission with the same key and the same input.

Save the id returned by task creation and query its status with the same API Key. After state is succeeded, read results[].url and check billing_state separately.

GET /v1/tasks/{id}

bash
curl 'https://www.lvzhouai.cc/v1/tasks/TASK_ID' \
-H "Authorization: Bearer YOUR_API_KEY"

Read results[].url and results[].expires_at when available. Result links are temporary; save files you need to keep. Querying the same task refreshes the site access link without creating another generation. An upstream result may still expire.

Troubleshooting requests

401 / 403
Check the API Key status and its model permissions.
400
Check the model ID and the supported input specification.
402
The available balance is insufficient for this request.
409
Use the original Idempotency-Key with identical input, or create a new key for a different operation.
429
Wait for the Retry-After interval before retrying.
503
The service may be paused or not configured. Check availability with the administrator.

Keep the X-Oneapi-Request-Id response header when reporting a problem. Never include your API Key, password or verification code.

Do not automatically retry after a text stream has started. Keep the request ID and check your usage records if the connection is interrupted.

View usage