API Reference
POST/v1/chat/completions

Chat Completions

Creates a model response for the given conversation. Fully compatible with the OpenAI Chat Completions API — existing SDKs work without modification.

Request body

ParameterTypeDescription
modelrequiredstringThe model to use. Currently "default" is supported, which maps to google/gemma-3-4b-it via Simplismart.
messagesrequiredarrayArray of message objects. Each has role ("system", "user", or "assistant") and content (string).
streambooleanIf true, tokens are sent as server-sent events as they are generated. Defaults to false.
temperaturenumberSampling temperature between 0 and 2. Higher values produce more random output. Defaults to 1.
max_tokensintegerMaximum tokens to generate. Defaults to model maximum if not set.
top_pnumberNucleus sampling — only the top-p probability mass is considered. Defaults to 1.
stopstring | arrayUp to 4 sequences where the API will stop generating. Can be a string or array of strings.
nintegerNumber of chat completion choices to generate. Defaults to 1.

Example request

request.json
{
  "model": "default",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user",   "content": "What is the capital of France?"}
  ],
  "temperature": 0.7,
  "max_tokens": 256,
  "stream": false
}

Response

Returns a chat.completion object when stream=false, or a stream of chat.completion.chunk events when stream=true.

Non-streaming response

response.json
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1748000000,
  "model": "default",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The capital of France is Paris."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 28,
    "completion_tokens": 9,
    "total_tokens": 37
  }
}

Streaming response (SSE)

Each line is a data: event. Read choices[0].delta.content and concatenate chunks until you receive data: [DONE].

stream response
data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","choices":[{"delta":{"role":"assistant"},"index":0}]}

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

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

data: [DONE]

Error codes

401
Unauthorized
Missing or invalid API key. Check the Authorization header.
402
Insufficient balance
Wallet balance is too low. Top up at Dashboard → Add credits.
422
Validation error
Request body is malformed. Check the required fields above.
429
Rate limited
Too many requests. Slow down and retry with exponential backoff.
502
Provider error
The upstream LLM provider returned an error. Retry the request.
Live Playground

Get your key from Dashboard → API Keys. Stored only in your browser.