คู่มือการใช้งาน API
เริ่มต้นเรียก AI Gateway ของ Wisporta ใน 3 ขั้นตอน
1. Get your API key
Sign in to your Wisporta dashboard and create an API key under API Keys. Your key will start with sk-live-
2. Make your first request
Use the same OpenAI-compatible format — just change the base URL and API key.
bash
curl https://api.wisporta.com/v1/chat/completions \
-H "Authorization: Bearer sk-live-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"messages": [
{ "role": "user", "content": "Hello!" }
]
}'3. Streaming response
Add "stream": true to receive real-time tokens.
bash
curl https://api.wisporta.com/v1/chat/completions \
-H "Authorization: Bearer sk-live-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4-6",
"messages": [{ "role": "user", "content": "Tell me a joke" }],
"stream": true
}'
# Response stream:
# data: {"choices":[{"delta":{"content":"Why"},"index":0}]}
# data: {"choices":[{"delta":{"content":" did"},"index":0}]}
# data: [DONE]4. Error handling
json
{
"error": {
"message": "Insufficient credit balance",
"type": "insufficient_credit",
"code": 402
}
}| Error type | HTTP | Meaning |
|---|---|---|
| unauthorized | 401 | Invalid or missing API key |
| insufficient_credit | 402 | Credit balance is zero |
| rate_limited | 429 | Too many requests |
| upstream_error | 502 | Provider returned an error |
5. Supported providers
- •OpenAI —
openai/gpt-4o,openai/gpt-4o-mini - •Anthropic —
anthropic/claude-sonnet-4-6 - •Google —
google/gemini-2.5-pro - •Mistral —
mistral/mistral-large
See full model list on the Pricing page.