STOP WASTING PAID TOKENS. START POOLING ACCOUNTS TODAY. [ GET YOUR VAULT ]

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 (query, boolean, optional) — 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)

Request body

curl -X POST 'https://spideriq.ai/api/gate/v1/chat/completions' \
  -H 'Authorization: Bearer <token>' \
  -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 <token>", "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 <token>", "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 <token>")
	req.Header.Set("Content-Type", "application/json")
	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
}

Responses

  • 200 — Successful completion

  • 400 — Invalid request

  • 401 — Authentication error

  • 429 — Rate limit exceeded

  • 500 — Internal error

  • 422 — Validation Error