常见问题¶
本文档整理用户常见问题及解答。
通用问题¶
接口相关问题¶
LiteLLM 调用本站接口时 reasoning_effort 参数无效怎么办?¶
使用 LiteLLM 平台调用本站接口时,如果在顶层使用 reasoning_effort 参数开启思考模式无效,建议将 reasoning_effort 放在 extra_body 中传递,这样会并入请求体正确发送。
方式一:顶层使用 reasoning_effort(LiteLLM 中可能无法正确传递)
from litellm import completion
# 顶层传参可能无法正确传递至本站接口
response = completion(
model="openai/gpt-4o",
api_base="https://api.agtcloud.ai/v1",
api_key="your-api-key",
messages=[{"role": "user", "content": "请分析一下 9.11 和 9.8 哪个更大?"}],
reasoning_effort="medium", # 顶层传参可能无效
)
print(response.choices[0].message.content)
如何记录 request-id 以便我们查询日志?¶
当你遇到请求失败、响应异常或其他需要排查的问题时,请优先记录响应头中的 request-id。我们可以据此在后台定位对应日志,从而更快排查原因。
一般情况下,request-id 会在响应头里以 x-oneapi-request-id 返回,例如:
x-oneapi-request-id: 20250312190218573397380LcOJ8kJX
下面以 Python requests 为例展示如何获取:
import requests
url = "https://api.xxx.com/v1/chat/completions"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
}
data = {
"model": "xxx",
"messages": [{"role": "user", "content": "hello"}],
}
resp = requests.post(url, headers=headers, json=data)
# 获取 request-id(响应头里的 x-oneapi-request-id)
request_id = resp.headers.get("x-oneapi-request-id")
print("request_id:", request_id)
print("response:", resp.json())
你可以直接到后台 /console/log 页面,在 request-id 搜索栏中填写你记录的值即可查询。