Docs
Quickstart
Siren is OpenAI-compatible. If your code already talks to the OpenAI API, you change two values: the base URL and the model.
1. Get an API key
- Sign in to the console with Google or an email link. New accounts get $5 of credit, once, with no card.
- Open API keys, click Create key, and give it a name.
-
Copy the secret (it starts with
sk-siren-). It is shown once; if you lose it, revoke the key and make another.
Keep keys server-side or in your frontend's key field. Never ship one inside a public web page or app bundle.
2. Make your first call
Install the official SDK (pip install openai or npm install openai) and set the base URL
to https://api.siren-rp.com/v1.
from openai import OpenAI
client = OpenAI(base_url="https://api.siren-rp.com/v1", api_key="sk-siren-...")
reply = client.chat.completions.create(
model="siren-rp",
messages=[
{"role": "system", "content": "You are Kaela, a wolf youkai roommate. Playful, loyal, dramatic."},
{"role": "user", "content": "I'm home! Did you leave me any dumplings?"},
],
temperature=0.9,
)
print(reply.choices[0].message.content) import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.siren-rp.com/v1", apiKey: "sk-siren-..." });
const reply = await client.chat.completions.create({
model: "siren-rp",
messages: [
{ role: "system", content: "You are Kaela, a wolf youkai roommate. Playful, loyal, dramatic." },
{ role: "user", content: "I'm home! Did you leave me any dumplings?" },
],
temperature: 0.9,
});
console.log(reply.choices[0].message.content); curl https://api.siren-rp.com/v1/chat/completions \
-H "Authorization: Bearer $SIREN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "siren-rp",
"messages": [
{"role": "system", "content": "You are Kaela, a wolf youkai roommate. Playful, loyal, dramatic."},
{"role": "user", "content": "I'"'"'m home! Did you leave me any dumplings?"}
],
"temperature": 0.9
}' | Base URL | https://api.siren-rp.com/v1 |
|---|---|
| Model | siren-rp |
| Auth header | Authorization: Bearer sk-siren-… |
3. Stream the reply
Set stream: true to receive tokens as they are written, as server-sent events in the OpenAI format.
Ask for stream_options.include_usage and the last chunk carries the token counts for the whole
request.
stream = client.chat.completions.create(
model="siren-rp",
messages=messages,
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if chunk.usage: # the last chunk carries usage
details = chunk.usage.prompt_tokens_details
print("\ncached:", details.cached_tokens if details else 0, "of", chunk.usage.prompt_tokens)
const stream = await client.chat.completions.create({
model: "siren-rp",
messages,
stream: true,
stream_options: { include_usage: true },
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
if (chunk.usage) {
const cached = chunk.usage.prompt_tokens_details?.cached_tokens ?? 0;
console.log(`\ncached: ${cached} of ${chunk.usage.prompt_tokens}`);
}
}
curl -N https://api.siren-rp.com/v1/chat/completions \
-H "Authorization: Bearer $SIREN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "siren-rp", "stream": true,
"messages": [{"role": "user", "content": "Tell me a two-line ghost story."}]}'
4. Read the cached token count
Every response, streamed or not, ends with a usage object:
"usage": {
"prompt_tokens": 8120,
"completion_tokens": 312,
"total_tokens": 8432,
"prompt_tokens_details": { "cached_tokens": 7680 }
}
cached_tokens is the part of the prompt the GPU already held from a recent request. Those tokens bill
at $0.05 per 1M instead of $0.20.
In the example above, 7,680 of 8,120 prompt tokens were cached. See Prompt caching to
keep that share high.
Next steps
- API reference: every endpoint, parameter and error code.
- Playground: try a character card and sampler settings in the browser.