LLM GatewayDocs
💬 Chat

LLM Gateway API Reference

LLM Gateway is a resilient, unified AI proxy service that sits between your client applications and upstream AI model providers. It provides automated free model discovery, sub-second Groq inference, large-context Google Gemini reasoning, native multi-model fallback chaining, and retry handling.

Authentication

All endpoints (except health check) are strictly protected to prevent unauthorized public consumption. Include your internal bearer token in the HTTP Authorization header:

Authorization: Bearer <YOUR_INTERNAL_TOKEN>

Quickstart Integration

cURL Command
# 1. Universal Auto Cascade Chat Completion
curl -X POST https://ai.buildbyzaki.space/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_INTERNAL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "messages": [
      {"role": "system", "content": "You are a helpful coding assistant."},
      {"role": "user", "content": "Tuliskan contoh TypeScript utility function."}
    ],
    "temperature": 0.7
  }'

# 2. Ultra-Fast Groq Inference (300-1000 t/s)
curl -X POST https://ai.buildbyzaki.space/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_INTERNAL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "groq/openai/gpt-oss-120b",
    "messages": [{"role": "user", "content": "Jelaskan perbedaan SQL vs NoSQL"}]
  }'

# 3. Simple Streaming Gateway Endpoint
curl -N -X POST https://ai.buildbyzaki.space/api/chat \
  -H "Authorization: Bearer YOUR_INTERNAL_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [{"role": "user", "content": "Ceritakan lelucon programmer"}],
    "model": "google/gemini-3.6-flash",
    "stream": true
  }'

Supported Providers & Universal Cascade

Using model: "auto" activates the Universal Multi-Provider Cascade (Tier 1: Groq Ultra-Fast ➔ Tier 2: Google Gemini 3.6 Flash ➔ Tier 3: OpenRouter Curated Free Pool).

⚡ Groq Cloud (Ultra Fast)
Inference hardware dedicated untuk kecepatan luar biasa (300-1000 tokens/sec).
groq/openai/gpt-oss-120b
🌟 Google Gemini (Smart Reasoning)
Model cerdas Google dengan context raksasa hingga 1.000.000 tokens.
google/gemini-3.6-flash
🌐 Auto (Curated OpenRouter Free Pool)
Otomatis memilih top 3 model gratis terkurasi (MiniMax M3, Dots 3 Note, Ling 3.0 Flash, dll).
auto (atau parameter model kosong)
POST

/api/v1/chat/completions

OpenAI standard chat completions endpoint. Fully compatible with OpenAI SDK in Python, Node.js, Go, LangChain, LlamaIndex, and Cursor.

Request Body (JSON)
{
  "model": "auto", // Optional - "auto", "groq/openai/gpt-oss-120b", "google/gemini-3.6-flash"
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"}
  ],
  "stream": false, // Optional - true for SSE streaming
  "temperature": 0.7, // Optional - 0.0 to 2.0
  "max_tokens": 1000 // Optional
}
POST

/api/chat

Simplified gateway endpoint that returns a direct string or SSE stream for internal microservices and frontend clients.

POST

/api/v1/embeddings

OpenAI-compatible text vector embeddings endpoint for RAG pipelines and semantic search.

GET

/api/models

Returns the dynamic list of curated active free models from OpenRouter, their context window lengths, and active fallback pools.

GET

/api/health

Public health check endpoint reporting active configured providers (OpenRouter, Groq, Google) and system status.