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

Item Value
Base URL https://api.calgine.com.cn
Authentication Header Authorization: Bearer sk-your-token
Request body JSON, Content-Type: application/json

Authentication

Every endpoint expects your API token in the request header:

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

Endpoint groups

Chat endpoints

Endpoint Protocol Description
POST /v1/chat/completions OpenAI-compatible Chat completions with streaming and tool calling — see Language Models
POST /v1/responses OpenAI-compatible Responses API, OpenAI models only
POST /anthropic/v1/messages Anthropic-compatible Messages API for Anthropic SDKs — see Language Models

Model list

Endpoint Description
GET /v1/models Returns all model IDs available to the token's group, in OpenAI-compatible format
{
  "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:

Endpoint Description
POST /v1/task/submit Submit 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:

{
  "error": {
    "message": "Invalid API key provided",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}
Status Common causes
400 Missing or invalid parameters, model unavailable, malformed request body
401 Invalid, deleted or unauthorised token
402 Insufficient balance — top up in the console
404 Wrong endpoint path or task not found
429 Rate limited — slow down and retry
5xx Service 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:

Parameter Description
p Page number, starting at 1
page_size Items 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