Api reference
Embeddings
An OpenAI-compatible text embedding endpoint, including request parameters, billing rules, and error reference.
Request
- Authentication: request header
Authorization: Bearer sk-tp-...(create an API Key in the Console) - Content-Type:
application/json
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Platform embedding model name; see Model list or Models |
| input | string | string[] | Yes | Text to embed; pass an array to batch in one request, billed by the total tokens returned by the upstream |
| Other parameters | - | No | dimensions, encoding_format, and others are passed through per the OpenAI protocol; whether they take effect depends on the model called |
Response
Returns OpenAI Embedding JSON (object / data[].embedding vector array / usage). The response headers carry billing information for this call:
| Header | Description |
|---|---|
| X-Cost-Yuan | Cost of this call (yuan, 6 decimal places) |
| X-Usage-Tokens | Total tokens for this call |
Billing
- Settled as
usage.prompt_tokensreturned by the model multiplied by the model's input price (yuan per million tokens). See Billing. - Costs are deducted from the account balance; every quota-limited key node along the request chain accumulates its subtree consumption.
Pre-checks
Before the call, the platform validates in order; if any step fails, an error is returned:
- Key valid and not revoked (including all parents), account status normal → otherwise
401 - Model exists and is available (
LIVE), is token-billed, and has an input price configured → otherwise400 inputis not empty → otherwise400- Account balance greater than 0, key chain quota not exhausted → otherwise
402
Errors
For the error response body format and troubleshooting, see FAQ · Error codes. Errors returned by the upstream model service are passed through verbatim (status code and response body unchanged).