curl

Call the SrotGateway API from the command line with curl.

View as Markdown

export SROT_API_KEY="sg-..."

List models

curl https://api.srotgateway.in/v1/models

Chat

curl https://api.srotgateway.in/v1/chat/completions \
  -H "Authorization: Bearer $SROT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash-fast",
    "messages": [{"role": "user", "content": "What is UPI?"}],
    "max_tokens": 300
  }'

Streaming

Add "stream": true and -N so curl prints each piece as it arrives:

curl -N https://api.srotgateway.in/v1/chat/completions \
  -H "Authorization: Bearer $SROT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4.1-flash-fast", "stream": true, "messages": [{"role": "user", "content": "Count to 20"}]}'

Each line starts with data: and holds one JSON piece. The stream ends with data: [DONE].