First request
Choose your language. Set the model to a Gateway pool alias such as YOUR_POOL — not a vendor model id.
chat.py
from openai import OpenAI
client = OpenAI(base_url="https://your-domain.demo/v1", api_key="YOUR_GATEWAY_KEY")
print(client.models.list())
print(client.chat.completions.create(
model="YOUR_POOL",
messages=[{"role": "user", "content": "ping"}],
))import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://your-domain.demo/v1", apiKey: "YOUR_GATEWAY_KEY" });
console.log(await client.models.list());
console.log(await client.chat.completions.create({
model: "YOUR_POOL",
messages: [{ role: "user", content: "ping" }],
}));package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte("{\"model\":\"YOUR_POOL\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello from Zenith\"}]}")
req, _ := http.NewRequest("POST", "https://your-domain.demo/v1/chat/completions", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("ZENITH_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
fmt.Println(string(data))
}<?php
$ch = curl_init("https://your-domain.demo/v1/chat/completions");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("ZENITH_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"model" => "YOUR_POOL",
"messages" => [["role" => "user", "content" => "Hello from Zenith"]],
]),
]);
echo curl_exec($ch);
curl_close($ch);curl -sS "$ZENITH_GATEWAY_URL/v1/chat/completions" \
-H "Authorization: Bearer $ZENITH_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "YOUR_POOL",
"messages": [{"role": "user", "content": "Hello Zenith"}]
}'MCP authorize (control plane only)
Allowlist + audit. Zenith does not execute MCP tools on the gateway. The JSON body field is name (not tool).
mcp-authorize.sh
curl -fsS -H "Authorization: Bearer $ZENITH_API_KEY" "$ZENITH_GATEWAY_URL/v1/mcp/tools"
curl -sS -H "Authorization: Bearer $ZENITH_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"d1_search"}' "$ZENITH_GATEWAY_URL/v1/mcp/authorize"Optional routing headers
- X-Zenith-Route-Key — sticky/route hint
- X-Zenith-Semantic-Route: 1 — enable semantic routing when configured
- X-Zenith-Cache: exact — request exact cache behavior when enabled