cURL
cURL is the fastest way to try the API without installing an SDK.
Chat Completions
Section titled “Chat Completions”curl https://llmtr.com/v1/chat/completions \ -H "Authorization: Bearer sk_your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-4o", "messages": [ {"role": "user", "content": "Hello!"} ] }'Streaming
Section titled “Streaming”curl -N https://llmtr.com/v1/chat/completions \ -H "Authorization: Bearer sk_your_key" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-4o", "messages": [{"role": "user", "content": "Count to 5"}], "stream": true }'-N disables buffering so SSE chunks print as they arrive.
File upload
Section titled “File upload”curl https://llmtr.com/v1/files \ -H "Authorization: Bearer sk_your_key" \ -F "provider=google" \ -F "purpose=user_upload" \ -F "file=@./document.pdf"Environment variable
Section titled “Environment variable”Don’t inline the key — use an env var:
export LLMTR_API_KEY="sk_your_key"
curl https://llmtr.com/v1/chat/completions \ -H "Authorization: Bearer $LLMTR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"openai/gpt-4o","messages":[{"role":"user","content":"Hi"}]}'Formatted response
Section titled “Formatted response”Use jq to pretty-print:
curl ... | jq '.choices[0].message.content'