Getting started

Quickstart

Send your first request in a few minutes. LLMHub follows the OpenAI API format, so existing OpenAI code works after changing the base URL and key.

1. Get an API key

  • Create an account and top up your balance.
  • Generate an API key in the dashboard. Each key has its own budget.
  • Store the key in an environment variable, for example LLMHUB_API_KEY. Never expose it in browser code.

2. Send a request

curl
curl https://api.llm-hub.dev/v1/chat/completions \
  -H "Authorization: Bearer $LLMHUB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-sol",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
Python (openai)
from openai import OpenAI

client = OpenAI(
    base_url="https://api.llm-hub.dev/v1",
    api_key="YOUR_LLMHUB_API_KEY",
)

response = client.chat.completions.create(
    model="gpt-5.6-sol",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
JavaScript (openai)
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.llm-hub.dev/v1",
  apiKey: process.env.LLMHUB_API_KEY,
});

const response = await client.chat.completions.create({
  model: "gpt-5.6-sol",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);

3. Next steps

Last updated