跳转到内容

使用 cURL

先设置令牌:

Terminal window
export PERCEPTLEAP_API_KEY="<YOUR_API_KEY>"
Terminal window
curl https://newapi.perceptleap.com/v1/responses \
-H "Authorization: Bearer $PERCEPTLEAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"input": "写一个安全解析 JSON 的 Go 函数。"
}'
Terminal window
curl https://newapi.perceptleap.com/v1/chat/completions \
-H "Authorization: Bearer $PERCEPTLEAP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4",
"messages": [
{"role": "user", "content": "解释这段代码的时间复杂度。"}
]
}'
Terminal window
curl https://newapi.perceptleap.com/v1/models \
-H "Authorization: Bearer $PERCEPTLEAP_API_KEY"

使用 curl --fail-with-body 可让 HTTP 错误产生非零退出码,同时保留服务端错误正文用于排查。