DEVSAIO

AI API curl cheat sheet: chat, streaming, images, embeddings

Copy-paste curl commands for every common AI API call, useful for testing and debugging.

DEVSAIO team · 1 min read
Share on X

Set your key once:

bash
export DEVSAIO_API_KEY=YOUR_KEY
export BASE=https://devsaio.lol/v1

List models

bash
curl $BASE/models -H "Authorization: Bearer $DEVSAIO_API_KEY"

Chat

bash
curl $BASE/chat/completions -H "Authorization: Bearer $DEVSAIO_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4-6","messages":[{"role":"user","content":"Hello"}]}'

Streaming (-N disables buffering)

bash
curl -N $BASE/chat/completions -H "Authorization: Bearer $DEVSAIO_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4-6","stream":true,"messages":[{"role":"user","content":"Count to 5"}]}'

System prompt and max tokens

bash
curl $BASE/chat/completions -H "Authorization: Bearer $DEVSAIO_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"gpt-5.6-luna","max_tokens":200,"messages":[{"role":"system","content":"Reply in French."},{"role":"user","content":"Good morning"}]}'

Anthropic format

bash
curl https://devsaio.lol/v1/messages -H "x-api-key: $DEVSAIO_API_KEY" -H "anthropic-version: 2023-06-01" -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-4-6","max_tokens":300,"messages":[{"role":"user","content":"Hi"}]}'

Embeddings

bash
curl $BASE/embeddings -H "Authorization: Bearer $DEVSAIO_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"bge-m3","input":"The quick brown fox"}'

Image generation

bash
curl $BASE/images/generations -H "Authorization: Bearer $DEVSAIO_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"doubao-seedream-5-0-pro-260628","prompt":"A watercolor lighthouse at dawn","n":1}'

Pretty-print with jq

bash
curl -s $BASE/chat/completions ... | jq -r '.choices[0].message.content'

Debugging tips

  • Add -i to see the HTTP status and headers.
  • 401 means a bad key; 402/403 usually means balance or a key limit; see API error codes explained.
Try it with one API key

Claude, GPT, Gemini, DeepSeek, image and video models through one OpenAI- and Anthropic-compatible endpoint. Prepaid, pay only for what you use.

Keep reading