Api reference
Responses
An endpoint compatible with the OpenAI Responses API, suited to generation tasks with instructions and structured output.
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 model name; see Model list or Models |
| input | string | array | Yes | Input content (text or a message array); must not be empty |
| Other parameters | - | No | instructions, max_output_tokens, metadata, and others are passed through per the OpenAI protocol |
| stream | boolean | - | Streaming is not yet supported; passing true returns 400 |
Response
Returns OpenAI Responses JSON (id / status / output / 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 by
usage.input_tokens/usage.output_tokensreturned by the model, in "yuan per million tokens", with input and output priced separately. See Billing. - Cached-hit / cache-write tokens in
usage.input_tokens_detailsare priced separately at the cache price; if a model has no cache price configured, the input price applies. - 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) and is token-billed → otherwise400 inputis not empty andstreamis not enabled → 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).