cURL Examples

Use cURL to test the API directly from your terminal. Set your API key as an environment variable for convenience:

export RELAY_API_KEY="sk-your-key-here"

Chat Completion

curl https://api.relay-station.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $RELAY_API_KEY" \
  -d '{
    "model": "deepseek-chat",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is the capital of France?"}
    ]
  }'

Streaming (SSE)

curl https://api.relay-station.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $RELAY_API_KEY" \
  -d '{
    "model": "deepseek-chat",
    "messages": [{"role": "user", "content": "Count to 10."}],
    "stream": true
  }'

List Models

curl https://api.relay-station.com/v1/models \
  -H "Authorization: Bearer $RELAY_API_KEY" | jq .

Check Balance

curl https://api.relay-station.com/v1/dashboard/billing \
  -H "Authorization: Bearer $RELAY_API_KEY" | jq .

Quick Test with a One-liner

curl -s https://api.relay-station.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $RELAY_API_KEY" \
  -d '{"model":"deepseek-chat","messages":[{"role":"user","content":"Say hello"}]}' \
  | jq -r '.choices[0].message.content'