排查问题最快的办法是用 cURL 脱离客户端直连。下面八条覆盖了日常绝大部分场景。
curl https://hardysapi.com/v1/chat/completions \ -H "Authorization: Bearer $KEY" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-5.5","messages":[{"role":"user","content":"hi"}]}'
curl https://hardysapi.com/v1/models -H "Authorization: Bearer $KEY" | python3 -m json.tool | grep '"id"'
curl -N https://hardysapi.com/v1/chat/completions \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{"model":"gpt-5.5","stream":true,"messages":[{"role":"user","content":"数到十"}]}'
curl -o /dev/null -s -w "code=%{http_code} ttfb=%{time_starttransfer} total=%{time_total}\n" \ https://hardysapi.com/v1/models -H "Authorization: Bearer $KEY"
curl -s -D - -o /dev/null https://hardysapi.com/v1/models \
-H "Authorization: Bearer $KEY"
curl -s https://hardysapi.com/v1/chat/completions \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{"model":"不存在的模型","messages":[]}' | python3 -m json.tool
curl https://hardysapi.com/v1/chat/completions \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{"model":"gpt-5.5","messages":[{"role":"user","content":[ {"type":"text","text":"图里是什么"}, {"type":"image_url","image_url":{"url":"https://example.com/a.jpg"}}]}]}'
curl https://hardysapi.com/v1/chat/completions \ -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \ -d '{"model":"claude-sonnet-4-5","messages":[{"role":"user","content":"北京天气"}], "tools":[{"type":"function","function":{"name":"get_weather", "parameters":{"type":"object","properties":{"city":{"type":"string"}}}}}]}'
Invoke-WebRequest 的别名,要写 curl.exe,
或把 JSON 存成文件用 -d "@body.json"。
用 curl.exe 并把 JSON 写入文件,再 -d "@body.json",可以避免引号转义问题。
加 -N(禁用缓冲),并设置 stream:true,就能看到分块输出。