Examples
curl
Copy-paste curl commands for chat completions, streaming, and listing models.
Chat completions
curl https://litellm.tensorloop.tech/v1/chat/completions \
-H "Authorization: Bearer $TENSORLOOP_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{"role": "system", "content": "You are a terse assistant."},
{"role": "user", "content": "What is the capital of France?"}
]
}'Streaming
Add "stream": true and consume the SSE stream:
curl https://litellm.tensorloop.tech/v1/chat/completions \
-H "Authorization: Bearer $TENSORLOOP_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"stream": true,
"messages": [{"role": "user", "content": "Count to five."}]
}' \
--no-buffer--no-buffer keeps curl from holding output until the connection closes.
List models
curl https://litellm.tensorloop.tech/v1/models \
-H "Authorization: Bearer $TENSORLOOP_KEY"JSON mode
For models that support it:
curl https://litellm.tensorloop.tech/v1/chat/completions \
-H "Authorization: Bearer $TENSORLOOP_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"response_format": {"type": "json_object"},
"messages": [
{"role": "system", "content": "Respond only with JSON."},
{"role": "user", "content": "Give me an object with name and email."}
]
}'