验证 Key#

Terminal · Models
curl https://api.shrimpapi.example/v1/models \
  -H "Authorization: Bearer sk-YOUR_SHRIMPAPI_KEY"

Chat Completions#

Terminal · Chat Completions
curl https://api.shrimpapi.example/v1/chat/completions \
  -H "Authorization: Bearer sk-YOUR_SHRIMPAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6.2-sol","messages":[{"role":"user","content":"你好"}]}'

Messages#

Terminal · Messages
curl -N https://api.shrimpapi.example/v1/messages \
  -H "x-api-key: sk-YOUR_SHRIMPAPI_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-opus-5-5","max_tokens":1024,"stream":true,"messages":[{"role":"user","content":"你好"}]}'

Responses#

Terminal · Responses
curl -N https://api.shrimpapi.example/v1/responses \
  -H "Authorization: Bearer sk-YOUR_SHRIMPAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6.2-sol","input":"你好","stream":true}'

调试与响应#

  • 非流式响应是 JSON;流式为 SSE,curl -N 可禁用输出缓冲。
  • 添加 -i 查看响应头,保留 x-request-id 方便定位问题。
  • Windows 下建议使用 curl.exe;PowerShell 与 cmd 的引号、转义规则不同。
  • 404 先核对地址与模型,再排查客户端。

更多系统与语言示例#

Windows · 补充示例
Windows 示例
curl.exe https://api.shrimpapi.example/v1/models -H "Authorization: Bearer sk-YOUR_SHRIMPAPI_KEY"
Windows 示例
curl.exe https://api.shrimpapi.example/v1/chat/completions -H "Authorization: Bearer sk-YOUR_SHRIMPAPI_KEY" -H "Content-Type: application/json" -d "{\"model\":\"gpt-6.2-sol\",\"messages\":[{\"role\":\"user\",\"content\":\"你好\"}]}"