LLM API examples with curl command

Posted on Sun 19 April 2026 by Pavlo Khmel

List models:

curl https://example.com/v1/models -H "Authorization: Bearer sk-..MY..PESONAL..API..TOKEN.."

Test chat response:

curl https://example.com/v1/chat/completions -H "Authorization: Bearer sk-..MY..PESONAL..API..TOKEN.." -H "Content-Type: application/json" -d '{
    "model": "openai/gpt-oss-120b",
    "messages": [
      {"role": "user", "content": "Who are you?"}
    ]
  }'

Example with embedding model:

curl https://example.com/v1/embeddings -H "Authorization: Bearer sk-..MY..PESONAL..API..TOKEN.." -H "Content-Type: application/json" -d '{
    "model": "Qwen/Qwen3-Embedding-8B",
    "input": ["hello world", "this is another sentence"]
  }'

Example with custom system prompt, enabled thinking, and custom temperature, top_p, top_k, min_p, presence_penalty, repetition_penalty, seed. This example creates reprodusible result if model is running on a single GPU.

curl https://example.com/v1/chat/completions -H "Authorization: Bearer sk-..MY..PESONAL..API..TOKEN.." -H "Content-Type: application/json" -d '{
    "model": "Qwen/Qwen3.6-35B-A3B-FP8",
    "messages": [
    { "role": "system", "content": "You are senior web developer and a 3D artist with attention to details." },
    {"role": "user", "content": "Design a richly crafted voxel-art environment featuring a lighthouse on an island. There should be seagulls and boats. Include diverse vegetation on the island - and ensure the composition feels lively, colorful, and visually striking. Use any voxel or WebGL libraries you prefer, but deliver the entire project as a single, self-contained HTML file that I can open directly in web browser."}
    ],
    "chat_template_kwargs": {"enable_thinking": true},
    "temperature": 0,
    "top_p": 1.0,
    "top_k": 1,
    "min_p": 0.0,
    "presence_penalty": 0.0,
    "repetition_penalty": 1.0,
    "seed": 42
  }'| awk -F '```html' '{print $2}' | awk -F '```' '{print $1}' | sed 's/\\n/\n/g' | sed 's/\\"/"/g' > lighthouse.html