Text model guide
Setup
The chat endpoint is compatible with OpenAI Chat Completions. With an OpenAI SDK, set base_url to the API Base URL https://shixux.com/api followed by /v1, and set api_key to your API Key.
The endpoints accept API Keys only and do not allow cross-origin browser requests. Call them from your server and never expose your API Key in web pages or client apps.
Call POST /v1/chat/completions with a model ID listed in Text model overview as model.
from openai import OpenAI
client = OpenAI(base_url="https://shixux.com/api/v1", api_key="yb_xxx_yyy")
reply = client.chat.completions.create(
model="deepseek-v4.1-flash",
messages=[{"role": "user", "content": "Describe Shixu in one sentence."}],
max_tokens=512,
)
print(reply.choices[0].message.content)
print(reply.usage)Streaming
With stream: true, the response is text/event-stream. Each data line is a chat.completion.chunk, and the stream ends with data: [DONE]. To receive usage at the end of the stream, add "stream_options": {"include_usage": true} to the request.
curl -N 'https://shixux.com/api/v1/chat/completions' \
-H 'Authorization: Bearer yb_xxx_yyy' \
-H 'Content-Type: application/json' \
-d '{"model":"deepseek-v4.1-flash","stream":true,"stream_options":{"include_usage":true},"messages":[{"role":"user","content":"Hello"}]}'- A single request can last up to 10 minutes.
- If the client disconnects, generation stops and the usage produced so far is billed.
- If an error occurs after the stream has started, a data chunk containing
erroris sent before the stream ends. The HTTP status is already 200 at that point, so check the chunk content for errors.
Supported parameters
These request fields are supported: model, messages (text messages with the system, user and assistant roles), stream, stream_options.include_usage, max_tokens or max_completion_tokens, temperature, top_p, stop, presence_penalty, frequency_penalty, seed, response_format, reasoning_effort and user. Fields not listed are ignored.
n greater than 1, tool calls (function calling) and non-text content such as images are not supported yet and return 400 unsupported_parameter.
Models that support reasoning return their reasoning in message.reasoning_content; these tokens are billed at the output price.
Billing
Prices are in credits per million tokens, with separate input, cached input and output prices. Read them from pricing in GET /v1/models; usage records are available in the console.
- When the request starts, credits are reserved based on the estimated input length and
max_tokens(a default applies when it is omitted). If the balance is insufficient, the API returns402. - When generation completes, the request is settled against actual usage and any excess reservation is returned immediately.
- If the request fails or produces no billable output, the reservation is refunded in full. If a streaming request is interrupted, the usage actually produced is billed.
A larger max_tokens reserves more credits; set a smaller value when you only need a short answer. Price changes apply only to requests made after the change.
Limits and errors
Each account has limits on requests per minute and concurrent requests, and max_tokens and the request body size are also limited. Exceeding them returns the errors below. Error bodies use the OpenAI format:
{"error": {"message": "Rate limit of 60 requests per minute reached", "type": "rate_limit_error", "code": "rate_limit_exceeded", "param": null}}| HTTP | code | What to do |
|---|---|---|
| 400 | invalid_request, unsupported_parameter | Fix the request according to param |
| 401 | invalid_api_key | Check that the API Key is correct and has not been revoked |
| 402 | insufficient_credits | Top up, or lower max_tokens |
| 404 | model_not_found | Check the model ID against available models |
| 413 | request_too_large | Shorten the conversation |
| 429 | rate_limit_exceeded, concurrency_limit_exceeded | Wait for Retry-After, then retry |
| 502, 504 | service_unavailable | The service is temporarily unavailable; retry later |
| 503 | feature_disabled, service_unavailable | The feature is not enabled or the service is under maintenance |
Every response includes an X-Request-ID header. When contacting support about a problem, provide this value; you do not need to share your API Key or conversation content.