API Reference
Chat Completions
OpenAI-compatible /v1/chat/completions endpoint with SSE streaming.
Request
Bash
POST /v1/chat/completions
Authorization: Bearer slm_YOUR_KEY
Content-Type: application/json
{
"model": "sealevel",
"messages": [
{"role": "system", "content": "You are Sealevel, an expert Solana developer..."},
{"role": "user", "content": "Write an Anchor counter program"}
],
"max_tokens": 1024,
"temperature": 0.0,
"stream": true,
"stream_options": {"include_usage": true}
}Streaming response
Server-sent events, each data: line is a JSON chunk:
Text
data: {"choices":[{"delta":{"content":"Here"}}]}
data: {"choices":[{"delta":{"content":"'s"}}]}
...
data: {"usage":{"prompt_tokens":42,"completion_tokens":128,"total_tokens":170}}
data: [DONE]Non-streaming
Omit stream or set false. Response follows the OpenAI schema with choices[0].message.content.