Skip to content

API Reference Overview ​

Conventions shared by every Calgine Tokens API: authentication, endpoint groups, error codes and pagination.

Calgine Tokens offers OpenAI-compatible and Anthropic-compatible chat endpoints, plus helper endpoints such as the model list and the unified async task API. All endpoints share one set of authentication and error conventions.

Basics ​

ItemValue
Base URLhttps://api.calgine.com.cn
AuthenticationHeader Authorization: Bearer sk-your-token
Request bodyJSON, Content-Type: application/json

Authentication ​

Every endpoint expects your API token in the request header:

bash
curl https://api.calgine.com.cn/v1/models \
  -H "Authorization: Bearer sk-your-token"
  • Create API tokens under Workspace → API Tokens in the Calgine Tokens Console
  • The Anthropic-compatible endpoint also accepts the x-api-key header (matching the official SDK behaviour)
  • Management endpoints (/api/...) use an Admin Key instead of an API token — see What is an Admin Key

WARNING

Never embed tokens in frontend code or public repositories. If a token leaks, delete it in the console and create a new one immediately.

Endpoint groups ​

Chat endpoints ​

EndpointProtocolDescription
POST /v1/chat/completionsOpenAI-compatibleChat completions with streaming and tool calling — see Language Models
POST /v1/responsesOpenAI-compatibleResponses API, OpenAI models only
POST /anthropic/v1/messagesAnthropic-compatibleMessages API for Anthropic SDKs — see Language Models

Model list ​

EndpointDescription
GET /v1/modelsReturns all model IDs available to the token's group, in OpenAI-compatible format
json
{
  "object": "list",
  "data": [
    { "id": "gpt-4o", "object": "model", "created": 1711234567, "owned_by": "openai" }
  ]
}

Async task endpoints ​

Long-running generation tasks (video, image, music) go through the unified async API — see Async Tasks for details:

EndpointDescription
POST /v1/task/submitSubmit a task and get a task ID immediately
GET /v1/task/{task_id}Query task status and results

Error codes ​

Failed requests return a non-2xx status code with an OpenAI-style error object:

json
{
  "error": {
    "message": "Invalid API key provided",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}
StatusCommon causes
400Missing or invalid parameters, model unavailable, malformed request body
401Invalid, deleted or unauthorised token
402Insufficient balance — top up in the console
404Wrong endpoint path or task not found
429Rate limited — slow down and retry
5xxService temporarily unavailable or upstream timeout — retry later

An async task that is accepted but fails during execution does not produce an error status code; instead the task query returns status: "failed" with the reason in the error field — see Task statuses.

Pagination ​

List endpoints (such as the Admin Key log and key lists) use page-based pagination:

ParameterDescription
pPage number, starting at 1
page_sizeItems per page; each endpoint has its own upper limit

Responses include total (total items), page and page_size; some endpoints also provide has_more to indicate whether another page follows. Over wide time ranges total may come back as -1 for "unknown" — in that case page by has_more instead. See the Admin Key API Reference for details.

Next steps ​