Chat
POST
/api/gate/v1/chat/completions
Create Chat Completion
Create a chat completion with automatic provider routing and fallback. This endpoint is fully compatible with the OpenAI Chat Completions API. Supports streaming via stream: true parameter. SpiderGate Extensions: • spidergate_options.fallback_models: List of fallback models on failure • spidergate_options.timeout_ms: Request timeout in milliseconds • spidergate_options.cache_enabled: Enable response caching • spidergate_options.max_cost_usd: Maximum cost for this request
Parameters
include_route_trace
boolean
query
When true, include a route_trace array in the response body detailing each dispatch attempt (codex bypass, Router) with outcome, model, latency, and error details. Non-streaming only. (OPVS #4)
Responses
200Successful completion400Invalid request401Authentication error429Rate limit exceeded500Internal error422Validation Error
curl -X POST 'https://spideriq.ai/api/gate/v1/chat/completions' \
-H 'Authorization: Bearer ' \
-H 'Content-Type: application/json' \
-d '{
"model": "spideriq/fast",
"messages": [
{
"role": "user",
"content": "Extract the company name from: 'Acme Corp, Berlin'"
}
]
}'
import httpx
resp = httpx.post(
"https://spideriq.ai/api/gate/v1/chat/completions",
headers={"Authorization": "Bearer ", "Content-Type": "application/json"},
json={"model": "spideriq/fast", "messages": [{"role": "user", "content": "Extract the company name from: 'Acme Corp, Berlin'"}]},
)
resp.raise_for_status()
print(resp.json())
const resp = await fetch("https://spideriq.ai/api/gate/v1/chat/completions", {
method: "POST",
headers: { "Authorization": "Bearer ", "Content-Type": "application/json" },
body: JSON.stringify({"model": "spideriq/fast", "messages": [{"role": "user", "content": "Extract the company name from: 'Acme Corp, Berlin'"}]})
});
const data = await resp.json();
console.log(data);
package main
import (
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{"model": "spideriq/fast", "messages": [{"role": "user", "content": "Extract the company name from: 'Acme Corp, Berlin'"}]}`)
req, _ := http.NewRequest("POST", "https://spideriq.ai/api/gate/v1/chat/completions", body)
req.Header.Set("Authorization", "Bearer ")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
}
Request body
{"model":"spideriq/fast","messages":[{"role":"user","content":"Extract the company name from: 'Acme Corp, Berlin'"}]}