
This guide walks you through making your first LLM request through LLM Gateway. By the end, you'll...
This guide walks you through making your first LLM request through LLM Gateway. By the end, you'll have a working API key and a completed request visible in your dashboard.
.env file:export LLM_GATEWAY_API_KEY="llmgtwy_XXXXXXXXXXXXXXXX"
LLM Gateway uses an OpenAI-compatible API. Point your requests to https://api.llmgateway.io/v1 and you're done.
curl -X POST https://api.llmgateway.io/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $LLM_GATEWAY_API_KEY" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "What is an LLM gateway?"}
]
}'
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.llmgateway.io/v1",
apiKey: process.env.LLM_GATEWAY_API_KEY,
});
const response = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "What is an LLM gateway?" }],
});
console.log(response.choices[0].message.content);
import requests
import os
response = requests.post(
"https://api.llmgateway.io/v1/chat/completions",
headers={
"Content-Type": "application/json",
"Authorization": f"Bearer {os.getenv('LLM_GATEWAY_API_KEY')}",
},
json={
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "What is an LLM gateway?"}
],
},
)
response.raise_for_status()
print(response.json()["choices"][0]["message"]["content"])
If you're using the Vercel AI SDK, you can use the native provider:
import { llmgateway } from "@llmgateway/ai-sdk-provider";
import { generateText } from "ai";
const { text } = await generateText({
model: llmgateway("openai/gpt-4o"),
prompt: "What is an LLM gateway?",
});
Or use the OpenAI-compatible adapter:
import { createOpenAI } from "@ai-sdk/openai";
const llmgateway = createOpenAI({
baseURL: "https://api.llmgateway.io/v1",
apiKey: process.env.LLM_GATEWAY_API_KEY!,
});
Pass stream: true to any request and the gateway will proxy the event stream unchanged:
curl -X POST https://api.llmgateway.io/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $LLM_GATEWAY_API_KEY" \
-d '{
"model": "gpt-4o",
"stream": true,
"messages": [
{"role": "user", "content": "Write a short poem about APIs"}
]
}'
Every call appears in the dashboard with latency, cost, and provider breakdown. Go back to your project to see your request logged with the model used, token counts, cost, and response time.
The best part of using a gateway: switching providers is a one-line change. Try the same request with a different model:
# Anthropic
"model": "anthropic/claude-haiku-4-5"
# Google
"model": "google-ai-studio/gemini-2.5-flash"
Same API, same code. Just a different model string.
gemmaI ported the whole Gemma-4 family — E2B, E4B, 12B, 31B, and the 26B-A4B MoE — to run on...
communityHey DEV, I'm Tobore. Let's actually connect. I've been on here for a while now, mostly writing and...
ai(yep, kinda clickbait, just for the funsies 😊) At the beginning of the year, I relaunched my...
aiMy laptop was sitting idle with the fan at full tilt. Nothing was running that I knew of. The culprit...
githubactionsI Built a Thing! TL;DR — Google Gemini-based Pull Request reviews and Issue Triaging for...
aiI've been hearing the word "harness" thrown around a lot lately. I assumed it just meant "the IDE" or...
Workflows from the Neura Market marketplace related to this DeepSeek resource