Skip to main content

Xing-Xingchen

This document describes how to call the Xing series model inference service directly provided by Xingchen on the Alibaba Cloud Model Studio platform.

The features described in this topic are available only in the China (Beijing) region. To call the model, you must obtain and configure an API key in the China (Beijing) region.

Activate the service

  1. Go to the Model Studio console, search for Xing, find the Xing/Xing4.1-Preview model card, and click Activate Now.
  2. In the pop-up window, confirm the activation and authorization.
After you complete these steps, you can call the model service provided by Xingchen.

Getting started

Prerequisites Xing/Xing4.1-Preview is a hybrid thinking model directly provided by Xingchen. It supports only text input and runs in thinking mode by default:
  • Thinking mode (default, or enable_thinking: true): The model outputs its reasoning process (reasoning_content).
  • Non-thinking mode (enable_thinking: false): The model directly outputs the result without the reasoning process.
The following example calls Xing/Xing4.1-Preview in thinking mode with streaming output.
  • enable_thinking is not a standard OpenAI parameter. In the OpenAI Python SDK, pass it via extra_body. In the Node.js SDK, pass it as a top-level parameter.
  • For streaming output, include_usage in stream_options is forced to true and cannot be disabled.
  • Python
  • Node.js
  • curl
from openai import OpenAI
import os

# Initialize the OpenAI client
client = OpenAI(
    # If you have not configured an environment variable, replace the following line with your Model Studio API key: api_key="sk-xxx"
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    # The following URL is for the China (Beijing) region. Replace {WorkspaceId} with your Model Studio workspace ID. URLs vary by region.
    base_url="https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
)

messages = [{"role": "user", "content": "Which is larger, 9.9 or 9.11?"}]
completion = client.chat.completions.create(
    model="Xing/Xing4.1-Preview",
    messages=messages,
    stream=True,
    stream_options={
        "include_usage": True
    },
    # Thinking mode is enabled by default. To disable it, set enable_thinking to False
    extra_body={"enable_thinking": True}
)

reasoning_content = ""  # Full chain-of-thought
answer_content = ""  # Full response
is_answering = False  # Whether the response phase has started
print("\n" + "=" * 20 + "Chain-of-thought" + "=" * 20 + "\n")

for chunk in completion:
    if not chunk.choices:
        print("\n" + "=" * 20 + "Token usage" + "=" * 20 + "\n")
        print(chunk.usage)
        continue

    delta = chunk.choices[0].delta

    # Collect only the thinking content
    if hasattr(delta, "reasoning_content") and delta.reasoning_content is not None:
        if not is_answering:
            print(delta.reasoning_content, end="", flush=True)
        reasoning_content += delta.reasoning_content

    # When content is received, start the response
    if hasattr(delta, "content") and delta.content:
        if not is_answering:
            print("\n" + "=" * 20 + "Full response" + "=" * 20 + "\n")
            is_answering = True
        print(delta.content, end="", flush=True)
        answer_content += delta.content

Other features

FeatureSupportedNotes
Multi-turn conversationSupported—
Function callingSupportedparallel_tool_calls defaults to true. Passing false does not take effect
Context cacheSupportedImplicit cache. Input tokens that hit the cache are billed at 2% of the input price
Structured outputSupportedresponse_format supports {"type": "json_object"}
Partial modeUnsupported—
Web searchUnsupported—
Multimodal inputUnsupportedSupports only text input
Xing/Xing4.1-Preview does not support the following parameters: preserve_thinking, thinking_budget, tool_stream, enable_code_interpreter, enable_search, search_options, and skill.

Models and pricing

ModelDescription
Xing/Xing4.1-PreviewHybrid thinking model with thinking mode enabled by default. Context length: 1,048,576 tokens
For model pricing and rate limits, see Model pricing and Rate limits. You are charged based on the input and output tokens of the model.
In thinking mode, the chain-of-thought is billed as output tokens.

Error codes

If a model call fails and returns an error message, see Error codes for troubleshooting.