$LLMAI Docs

curl

Test and explore the LLMAI API directly from your terminal using curl.

Model slugs in examples are illustrative. Confirm current availability in the live catalog and your account's /v1/models before use.

Minimal Chat Request

The smallest valid request — one user message, no system prompt:

curl https://api.llmai.dev/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kimi-k2.7-code",
    "messages": [
      {"role": "user", "content": "What is a context window?"}
    ]
  }'

With a System Prompt and Parameters

Add a system message and tune temperature and max_tokens:

curl https://api.llmai.dev/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [
      {"role": "system", "content": "You are a senior software engineer. Be direct and precise."},
      {"role": "user",   "content": "What does Big-O notation tell you about an algorithm?"}
    ],
    "temperature": 0.3,
    "max_tokens": 200
  }'

Streaming Output

Set stream: true to receive the response incrementally as server-sent events:

curl https://api.llmai.dev/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-lite",
    "messages": [{"role": "user", "content": "Write a haiku about distributed systems."}],
    "stream": true
  }'

Each line in the response looks like data: {...}. The final line is data: [DONE].

Calling Different Models

# MiniMax M3 — best for long-context work (1M tokens)
curl https://api.llmai.dev/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "minimax-m3", "messages": [{"role": "user", "content": "Explain transformer attention."}]}'

# DeepSeek — cost-efficient reasoning
curl https://api.llmai.dev/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4-pro", "messages": [{"role": "user", "content": "Spot the bug in this SQL query."}]}'

# Z.AI GLM 5.3 Flash — multimodal, 1M context, always-on thinking
curl https://api.llmai.dev/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "glm-5.3-flash", "messages": [{"role": "user", "content": "Review this implementation plan."}]}'

List All Available Models

curl https://api.llmai.dev/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"

Practical Tips

Keep your key out of shell history — store it in an environment variable:

export LLMAI_KEY="sk-llmaai-your-key-here"

curl https://api.llmai.dev/v1/chat/completions \
  -H "Authorization: Bearer $LLMAI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "kimi-k2.7-code", "messages": [{"role": "user", "content": "Hello!"}]}'

Extract just the reply text with jq:

curl ... | jq -r '.choices[0].message.content'

Check token usage from the response:

curl ... | jq '.usage'

On this page