Qianwen Text
Generate text, have conversations, write code, reason, and call functions with Qwen models. TRIGGER when: user asks to chat with Qwen, generate text, write code with Qwen, use Qwen function calling, or explicitly invokes this skill by name (e.g. use qianwen-text). DO NOT TRIGGER when: general coding questions without Qwen, non-Qwen AI model usage (OpenAI, Gemini, etc.), image/video understanding (use qianwen-vision), image/video/audio generation.
- Skill ID
- qianwen-ai/qianwen-ai/qianwen-text
- Publisher
- qianwen-ai
- Repository
- qianwen-ai
- Installs
- 0
- Files
- 12
- Requires
- Requires Python 3.9+ and curl. Cursor: auto-loaded. Claude Code: read this skill's SKILL.md before first use.
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
qianwen-ai/qianwen-ai/qianwen-textInstalls these files- SKILL.md
- cdn/config/qianwen-text-config.json
- cdn/config/qianwen-token-plan-config.json
- cdn/references/qianwen-text-models.md
- cdn/references/qianwen-token-plan-models.md
- references/api-guide.md
- references/execution-guide.md
- references/prompt-guide.md
- references/sources.md
- scripts/gossamer.py
- scripts/qianwen_lib.py
- scripts/text.py
What this skill tells the agent
Qwen Text Chat (OpenAI-Compatible)
Generate text, conduct conversations, write code, and invoke tools using Qwen models through the OpenAI-compatible API. This skill is part of QianWen-AI/qianwen-ai.
Skill directory
Use this skill's internal files to execute and learn. Load reference files on demand when the default path fails or you need details.
| Location | Purpose |
|---|---|
scripts/text.py | Default execution — chat/completions request, streaming, output save |
references/execution-guide.md | Fallback: curl, Python SDK, function calling, thinking mode |
references/api-guide.md | API supplement and full code examples |
references/prompt-guide.md | Prompt engineering: CO-STAR framework, CoT, few-shot, task steps |
references/sources.md | Official documentation URLs (manual lookup only) |
Security
NEVER output any API key or credential in plaintext. Always use variable references ($DASHSCOPE_API_KEY in shell, os.environ["DASHSCOPE_API_KEY"] in Python). Any check or detection of credentials must be non-plaintext: report only status (e.g. "set" / "not set", "valid" / "invalid"), never the value. Never display contents of .env or config files that may contain secrets.
When the API key is not configured, NEVER ask the user to provide it directly. Instead, help create a .env file with a placeholder (DASHSCOPE_API_KEY=sk-your-key-here) and instruct the user to replace it with their actual key from the QianWen Console. Only write the actual key value if the user explicitly requests it.
Key Compatibility
Both PAYG (sk-ws-...; legacy sk-...) and Token Plan (sk-sp-...) keys are supported. Detect the API key type without exposing the Key:
python3 -c "
import sys; sys.path.insert(0, 'scripts')
from qianwen_lib import detect_api_key_type
print(detect_api_key_type('scripts/qianwen_lib.py'))
"| Output | Meaning |
|---|---|
token-plan | Token Plan key — use only models from the Token Plan catalog below. |
payg | Pay-as-you-go key — full model catalog available. |
not-set | No key configured. |
For Token Plan, fetch and read the current Token Plan model catalog, then use an exact listed model. If CDN access fails, use the local fallback.
Token Plan supports only specific models — use exactly a model from the references above; do not guess or probe model availability. For PAYG, continue below.
Model Selection
Before selecting, recommending, or defaulting a model, fetch and read the current Qwen text model catalog. It contains the model list, basic model information, recommendations, and default model. If CDN access fails, use the local fallback.
- User specified a model → use directly.
- Consult the qianwen-model-selector skill when model choice depends on requirement, scenario, or pricing.
- No signal, clear task → use the default from the model catalog. For strongest reasoning/coding, use its recommended high-capability option.
⚠️ Important: The model catalog is a point-in-time snapshot and may be outdated. Model availability changes frequently. Always check the [official model list](https://www.qianwenai.com/models) for the authoritative, up-to-date catalog before making model decisions.
Model details: For more information about a specific model, direct the user tohttps://www.qianwenai.com/models/<model-name>. Replace<model-name>with the exact model ID; never modify or guess it.
Dynamic model queries: If the qianwen-model-selector skill or QianWen CLI (qianwen models info <model>) is available, use it for real-time model data. CLI requires authentication — see the qianwen-usage skill for login flow.Execution
Prerequisites
- API Key: Use the non-plaintext detector in Key Compatibility; do not replace it with a variable-presence check. If no Key is found, use qianwen-ops-auth when available or guide the user to configure
DASHSCOPE_API_KEY/QIANWEN_API_KEYin.env. Skills may be installed independently. - Python 3.9+ (stdlib only, no pip install needed for script execution)
Environment Check
Before first execution, verify Python is available:
python3 --version # must be 3.9+If python3 is not found, try python --version or py -3 --version. If Python is unavailable or below 3.9, skip to Path 2 (curl)** in execution-guide.md.
Default: Run Script
Script path: Scripts are in the scripts/ subdirectory of this skill's directory (the directory containing this SKILL.md). You MUST first locate this skill's installation directory, then ALWAYS use the full absolute path to execute scripts. Do NOT assume scripts are in the current working directory. Do NOT use cd to switch directories before execution.
Execution note: Run all scripts in the foreground — wait for stdout; do not background.
Discovery: Run python3 <this-skill-dir>/scripts/text.py --help first to see all available arguments.
python3 <this-skill-dir>/scripts/text.py \
--request '{"messages":[{"role":"user","content":"Hello!"}],"model":"qwen3.7-plus"}' \
--output output/qianwen-text/ --print-responseFor streaming (recommended for interactive use):
python3 <this-skill-dir>/scripts/text.py \
--request '{"messages":[{"role":"user","content":"Write a poem about the sea"}],"model":"qwen3.7-plus"}' \
--stream --print-response| Argument | Description |
|---|---|
--request '{...}' | JSON request body |
--file path.json | Load request from file (alternative to --request) |
--stream | Enable streaming output |
--output path | Save response JSON to path (file if .json suffix, otherwise directory); use distinct filenames across calls to avoid overwriting |
--print-response | Print response to stdout |
--model ID | Override model (also settable in request JSON) |
Model priority:--modelCLI flag >"model"field in--requestJSON > built-in default.
Verify Result
- Exit code
0+ output contains valid JSON withchoicesfield → success - Non-zero exit, HTTP error, empty response, or JSON with
"code"/"message"error → fail - If agent cannot read exit codes, scan output for error patterns (
Error,Traceback,401,403) - Post-execution check: When
--outputis used, verify the response JSON file exists and containschoices - MANDATORY — stderr signal check: After confirming the result, scan the command's stderr output for
[ACTION_REQUIRED]or[UPDATE_AVAILABLE]. If either signal is present, you MUST follow the instructions in Update Check below before responding to the user.
On Failure
If the script fails, match the error output against the diagnostic table below to determine the resolution. If no match,
More from qianwen-ai
Use this skill in a project
Open any RiverX project, search the Skills panel for qianwen-ai/qianwen-ai/qianwen-text, and install it in one click.
