项目
在 GitHub 查看
fujc683/qwen4-max-api
关于
Qwen4 Max API: chat completions, streaming defaults and reasoning tokens.
人工智能与机器学习实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Qwen4 Max API — endpoint, streaming, reasoning tokens
How to call Qwen4 Max on APIMart: chat completions, streaming defaults and reasoning output.
https://gola.apimart.ai/k-SBK4VP
Endpoint
OpenAI-compatible chat completions:
curl -X POST https://api.apimart.ai/v1/chat/completions \
-H "Authorization: Bearer $APIMART_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"qwen4-max","messages":[{"role":"user","content":"explain vector databases"}]}'
Streaming
The endpoint streams by default. Parse data: lines, or pass "stream": false
for a single JSON body.
from openai import OpenAI
client = OpenAI(base_url="https://api.apimart.ai/v1", api_key=KEY)
for chunk in client.chat.completions.create(
model="qwen4-max",
messages=[{"role": "user", "content": "write a haiku"}],
stream=True):
print(chunk.choices[0].delta.content or "", end="")
Reasoning output
Qwen4 Max can emit a separate reasoning_content field alongside content.
Treat it as chain-of-thought: useful for debugging, not for showing to end users.
{"delta": {"role": "assistant", "content": "", "reasoning_content": "..."}}
usage.completion_tokens_details.reasoning_tokens tells you how many tokens were
spent thinking — that part is billed as output.
Parameters that matter
| Field | Notes |
|---|---|
messages |
standard role/content array |
stream |
true by default on this endpoint |
max_tokens |
cap output; reasoning tokens count toward it |
temperature |
0-2; lower for extraction, higher for ideation |
tools |
function calling, OpenAI schema |
Pricing
| Per 1M tokens | |
|---|---|
| Input | $1.4286 |
| Output | $4.2857 |
Gotchas
- Streaming is on unless you pass
stream: false - Reasoning tokens are billed as output — budget for 2-3x on hard tasks
- Very long prompts benefit from prompt caching; cached tokens are cheaper
Related
- All prompt collections: fujc683 repositories
License
CC BY 4.0
探索相关项目
加载中…