Chat

Base URL https://spideriq.ai/api/gate/v1
POST /chat/completions

Create a chat completion

Create a model response for a conversation. Same shape as OpenAI's Chat Completions, plus SpiderGate routing (`model` accepts a task alias) and `spidergate_options`.

Responses
  • 200A chat completion.
  • 400
  • 401
  • 402
  • 404
  • 429
  • 502
POST /chat/completions
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": "system",
      "content": "You are a concise assistant."
    },
    {
      "role": "user",
      "content": "In one sentence, what is an LLM gateway?"
    }
  ],
  "max_tokens": 60,
  "spidergate_options": {
    "max_cost_usd": 0.01
  }
}'
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": "system", "content": "You are a concise assistant."}, {"role": "user", "content": "In one sentence, what is an LLM gateway?"}], "max_tokens": 60, "spidergate_options": {"max_cost_usd": 0.01}},
)
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": "system", "content": "You are a concise assistant."}, {"role": "user", "content": "In one sentence, what is an LLM gateway?"}], "max_tokens": 60, "spidergate_options": {"max_cost_usd": 0.01}})
});
const data = await resp.json();
console.log(data);
package main

import (
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{"model": "spideriq/fast", "messages": [{"role": "system", "content": "You are a concise assistant."}, {"role": "user", "content": "In one sentence, what is an LLM gateway?"}], "max_tokens": 60, "spidergate_options": {"max_cost_usd": 0.01}}`)
	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":"system","content":"You are a concise assistant."},{"role":"user","content":"In one sentence, what is an LLM gateway?"}],"max_tokens":60,"spidergate_options":{"max_cost_usd":0.01}}