Text modelsText model guide

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 error is 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.

  1. 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 returns 402.
  2. When generation completes, the request is settled against actual usage and any excess reservation is returned immediately.
  3. 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}}
HTTPcodeWhat to do
400invalid_request, unsupported_parameterFix the request according to param
401invalid_api_keyCheck that the API Key is correct and has not been revoked
402insufficient_creditsTop up, or lower max_tokens
404model_not_foundCheck the model ID against available models
413request_too_largeShorten the conversation
429rate_limit_exceeded, concurrency_limit_exceededWait for Retry-After, then retry
502, 504service_unavailableThe service is temporarily unavailable; retry later
503feature_disabled, service_unavailableThe 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.

On this page