cURL Examples
You can use Liutong directly with cURL or any HTTP client. No SDK required.
Chat completion
curl https://api.liutong.llby.org/v1/chat/completions \
-H "Authorization: Bearer lt_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "crimson-falcon-4",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of Japan?"}
],
"temperature": 0.7,
"max_tokens": 256
}'
Streaming
curl https://api.liutong.llby.org/v1/chat/completions \
-H "Authorization: Bearer lt_your_api_key" \
-H "Content-Type: application/json" \
-N \
-d '{
"model": "crimson-falcon-4",
"messages": [{"role": "user", "content": "Count from 1 to 10 slowly."}],
"stream": true
}'
The -N flag disables output buffering so you see tokens as they arrive.
Reasoning
curl https://api.liutong.llby.org/v1/chat/completions \
-H "Authorization: Bearer lt_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "indigo-owl-4",
"messages": [
{"role": "user", "content": "Prove that there are infinitely many prime numbers."}
]
}'
Embeddings
curl https://api.liutong.llby.org/v1/embeddings \
-H "Authorization: Bearer lt_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "jade-mole-4",
"input": "Liutong makes inference affordable."
}'
Batch embeddings
curl https://api.liutong.llby.org/v1/embeddings \
-H "Authorization: Bearer lt_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "jade-mole-4",
"input": ["First text.", "Second text.", "Third text."]
}'
List models
curl https://api.liutong.llby.org/v1/models \
-H "Authorization: Bearer lt_your_api_key"