SoxAIDocs
Quickstart

cURL Quickstart

Make raw HTTP requests to the SoxAI API with cURL

cURL Quickstart

Chat Completion

curl https://api.soxai.io/v1/chat/completions \
  -H "Authorization: Bearer sox-your-token-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4-mini",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is 2 + 2?"}
    ]
  }'

Response:

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1743350400,
  "model": "gpt-5.4-mini",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "2 + 2 equals 4."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 23,
    "completion_tokens": 8,
    "total_tokens": 31
  }
}

Streaming

Add "stream": true to receive Server-Sent Events:

curl https://api.soxai.io/v1/chat/completions \
  -H "Authorization: Bearer sox-your-token-here" \
  -H "Content-Type: application/json" \
  --no-buffer \
  -d '{
    "model": "gpt-5.4-mini",
    "messages": [{"role": "user", "content": "Count to 5"}],
    "stream": true
  }'

Each SSE event looks like:

data: {"id":"chatcmpl-abc","object":"chat.completion.chunk","choices":[{"delta":{"content":"1"},"index":0}]}

data: {"id":"chatcmpl-abc","object":"chat.completion.chunk","choices":[{"delta":{"content":", 2"},"index":0}]}

data: [DONE]

Embeddings

curl https://api.soxai.io/v1/embeddings \
  -H "Authorization: Bearer sox-your-token-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "Hello, world!"
  }'

List Available Models

curl https://api.soxai.io/v1/models \
  -H "Authorization: Bearer sox-your-token-here"

Image Generation

curl https://api.soxai.io/v1/images/generations \
  -H "Authorization: Bearer sox-your-token-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "dall-e-3",
    "prompt": "A serene mountain lake at dawn",
    "n": 1,
    "size": "1024x1024"
  }'

Session Stickiness

Route follow-up requests to the same upstream provider:

curl https://api.soxai.io/v1/chat/completions \
  -H "Authorization: Bearer sox-your-token-here" \
  -H "Content-Type: application/json" \
  -H "X-Session-ID: my-conversation-id" \
  -d '{
    "model": "gpt-5.4-mini",
    "messages": [{"role": "user", "content": "Follow-up question..."}]
  }'

Using an Environment Variable

export SOXAI_API_KEY="sox-your-token-here"

curl https://api.soxai.io/v1/chat/completions \
  -H "Authorization: Bearer $SOXAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-5.4-mini", "messages": [{"role": "user", "content": "Hi!"}]}'