API docs
An OpenAI-compatible Chat Completions API. If your app can talk to OpenAI, it can talk to us.
| Base URL | https://api.smutwriter.com/v1 |
|---|---|
| Auth | Authorization: Bearer sk-swm-… |
| Model | smutwriter-v1 |
Using SillyTavern? Follow the step-by-step guide.
List models
curl https://api.smutwriter.com/v1/models -H "Authorization: Bearer $SWM_KEY"
Chat completion
curl https://api.smutwriter.com/v1/chat/completions \
-H "Authorization: Bearer $SWM_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "smutwriter-v1",
"stream": true,
"max_tokens": 800,
"messages": [
{"role": "system", "content": "You are Mara, a lighthouse keeper..."},
{"role": "user", "content": "I knock on the green door."}
]
}'
Streaming uses server-sent events, like OpenAI. Supported settings: max_tokens, temperature, top_p, top_k, min_p, frequency_penalty, presence_penalty, repetition_penalty, stop, seed, stream_options.include_usage. Replies are capped at 4096 tokens. The usage numbers in each response are what you are billed for.
Memory
Memory is automatic. A story is matched by your account and its longest leading system message (normally the character card). Add "story_id": "any-name" to the request body to keep separate memories for chats that share a card. In SillyTavern, put it under Additional Parameters → Include Body Parameters as story_id: my-second-run.
You can delete all story memory from your account page.
Limits
2 requests at a time and 30 per minute per account (shared by all its keys). Up to 32K tokens read per reply.
Errors
| Status | code | Meaning |
|---|---|---|
| 401 | invalid_api_key | Key missing, wrong, or revoked. |
| 402 | insufficient_balance | Credit is used up. Top up on your account page. |
| 400 | context_length_exceeded | The card alone is bigger than the context. |
| 400 | content_policy_violation | Blocked: content involving anyone under 18. |
| 429 | concurrency_limit / rate_limit_exceeded | Too many requests at once or per minute. |
| 503 | model_offline / overloaded | Temporarily offline or very busy. Try again shortly. |