curl
Test and explore the LLMAI API directly from your terminal using curl.
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": "gpt-5.4",
"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": "gpt-5.3-codex",
"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-flash-preview",
"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
# Google Gemini — best for long-context work
curl https://api.llmai.dev/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gemini-3.1-pro-preview", "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-v3.2", "messages": [{"role": "user", "content": "Spot the bug in this SQL query."}]}'
# Z.AI GLM — fast multilingual responses
curl https://api.llmai.dev/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "glm-5-turbo", "messages": [{"role": "user", "content": "Translate to Spanish: The server is down."}]}'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": "gpt-5.4", "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'