≡ All docs

API Guide / Overview

Overview

Updated: 2026-02-01

Before building with the platform's models, create an API Key to use as your authentication credential.

The StarUnion open platform exposes standard HTTP API endpoints and works with a wide range of languages and environments. The API is compatible with the OpenAI SDK — just point base_url at StarUnion to migrate an existing app with no other changes.

API Endpoint

The platform's base API endpoint is:

BASEhttps://www.starunion.net/v1

All API requests must use HTTPS. Resource-based paths are appended to the Base URL above, e.g. /chat/completions.

Authentication

The StarUnion API uses Bearer Token authentication. Add an Authorization header with the value Bearer YOUR_API_KEY to each request.

curl https://www.starunion.net/v1/models \
-H "Authorization: Bearer $API_KEY"

First Call

The example below shows how to generate a chat reply with doubao-seed-2-0-lite-260215. All snippets are verified to run as-is — just replace YOUR_API_KEY with your real key.

curl -X POST "https://www.starunion.net/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "doubao-seed-2-0-lite-260215",
"messages": [
{"role": "system", "content": "You are a professional AI assistant."},
{"role": "user", "content": "Hi, please introduce yourself."}
],
"temperature": 1.0,
"stream": false
}'

Response Format

Every Chat Completions response follows the OpenAI JSON schema, so existing ecosystem tooling works out of the box:

JSON
{
"id": "chatcmpl-7xN3f2k...",
"object": "chat.completion",
"created": 1708502400,
"model": "doubao-seed-2-0-lite-260215",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hi! I'm the AI assistant served through StarUnion..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 142,
"total_tokens": 170
}
}

Error Handling

When a request fails, the API returns a non-2xx HTTP status code and a JSON error body containing code and message fields. See the Error Codes section for details.

  • 401 Unauthorized — API Key missing or invalid
  • 429 Too Many Requests — rate limit hit; use exponential backoff retries
  • 500 Internal Server Error — platform-side error; contact support with the request-id

Didn't find what you were looking for?Contact us →