Skip to main content

Quickstart

1) Sign up & create a tenant

  1. Go to LLMGrid Console: https://app.llmgrid.ai
  2. Sign up and create your Tenant (organization).
  3. Create a default Project under your tenant.
  4. Invite your team and assign roles (Admin, Developer, Viewer).
Tenants and projects enforce isolation for routes, policies, tokens, and usage.

2) Connect providers (BYO keys)

In Console → Providers:
  • Add OpenAI, Azure OpenAI, Anthropic, or Google Gemini keys.
  • Optionally map Azure deployments to model IDs.
  • Configure timeouts and default regions per provider.

3) Create a route

In Console → Routes:
  • Create chat_default route:
    • Type: Chat
    • Strategy: Cost optimized
    • Models: e.g., openai:gpt-4o-mini, anthropic:claude-3-haiku
    • Policies: rate limit, budget, retries, redaction

4) Generate a user token

In Console → Access:
  • Create a Project Token (scoped to your project).
  • Copy token for client usage.

5) First request (curl)

curl -X POST https://app.llmgrid.ai/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_PROJECT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "tenant_id": "TENANT_123",
    "project_id": "PROJ_abc",
    "route": "chat_default",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Give me 3 creative taglines for a farm supply store."}
    ],
    "stream": false
  }'

6) Node.js Example


import fetch from "node-fetch";

const res = await fetch("https://app.llmgrid.ai/api/v1/chat/completions", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.LLMGRID_PROJECT_TOKEN,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    tenant_id: "TENANT_123",
    project_id: "PROJ_abc",
    route: "chat_default",
    messages: [
      { role: "system", content: "Be concise." },
      { role: "user", content: "Summarize the pros and cons of no-till farming." }
    ],
    stream: true
  })
});

// Handle streaming (SSE-like)
if (!res.ok) throw new Error(await res.text());
const reader = res.body.getReader();
for (;;) {
  const { value, done } = await reader.read();
  if (done) break;
  process.stdout.write(Buffer.from(value).toString());
}

6) Python Example



import requests, os

url = "https://app.llmgrid.ai/api/v1/chat/completions"
headers = {
    "Authorization": f"Bearer {os.environ['LLMGRID_PROJECT_TOKEN']}",
    "Content-Type": "application/json"
}
payload = {
    "tenant_id": "TENANT_123",
    "project_id": "PROJ_abc",
    "route": "chat_default",
    "messages": [
        {"role": "system", "content": "Answer clearly."},
        {"role": "user", "content": "What are common grain storage best practices?"}
    ],
    "stream": False
}

resp = requests.post(url, json=payload, headers=headers, timeout=60)
resp.raise_for_status()
print(resp.json())