框架: max_tokens默认32000→12000(New-API按max_tokens预扣费,余额见底大请求403实测;输出实测最大6060,预扣降2/3)
This commit is contained in:
parent
d615af31c6
commit
d8b7c66661
@ -28,13 +28,16 @@ class SensitiveError(Exception):
|
||||
立即抛给上层走模型降级链(创始人 2026-07-14:M3→MiniMax-M2.7→deepseek-v4-flash)。"""
|
||||
|
||||
|
||||
def chat(prompt, model=DEFAULT_MODEL, max_tokens=32000, temperature=0.2,
|
||||
def chat(prompt, model=DEFAULT_MODEL, max_tokens=12000, temperature=0.2,
|
||||
retries=2, timeout=900, system=None, top_p=None):
|
||||
"""单轮对话,返回 (content, usage)。网络错/5xx/429 指数退避重试。
|
||||
|
||||
content 已剥离 <think>…</think>(推理模型可能把思考混进正文)。
|
||||
system:身份段与任务材料分离(角色遵从更稳、身份段利于上游缓存)。
|
||||
top_p:随 temperature 分化实验用(M 家族官方推荐 1.0/0.95,eval A/B 后定版)。
|
||||
max_tokens 默认 12000(2026-07-15 降自 32000):New-API 按 max_tokens **预扣费**,
|
||||
余额低于预扣线时大请求 403(实测预扣 $0.00975/32k);全管线实测输出最大 6060、
|
||||
中位 331,12000 留一倍余量且预扣降 2/3——同样余额多跑 2.5 倍请求。
|
||||
"""
|
||||
s = requests.Session()
|
||||
s.trust_env = False # 本机代理 env 会劫持内网直连
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user