curl
使用 HTTP 和 curl 調用 Essevin 的相容介面。
| 模型類型 | 協議與端點 | 鑑權 |
|---|---|---|
| GPT / Gemini | POST https://api.essevin.com/v1/chat/completions | Authorization: Bearer |
| Claude | POST https://api.essevin.com/v1/messages | x-api-key |
模型 ID 要與金鑰分組對應
請使用目前套餐金鑰在 GET /v1/models 中實際返回的模型 ID。不同套餐分組的金鑰不可混用。
OpenAI 協議(GPT 模型)
curl https://api.essevin.com/v1/chat/completions \
-H "Authorization: Bearer sk-你的金鑰" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"messages": [{"role": "user", "content": "你好"}]
}'Anthropic 協議(Claude 模型)
curl https://api.essevin.com/v1/messages \
-H "x-api-key: sk-你的金鑰" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "你好"}]
}'串流輸出(加 "stream": true)
curl https://api.essevin.com/v1/chat/completions \
-H "Authorization: Bearer sk-你的金鑰" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-5.6-sol", "stream": true,
"messages": [{"role": "user", "content": "你好"}]}'