Moonborn — API · chat
One-shot chat against a persona (no session is created)
Streams the assistant reply when `stream=true` (text/event-stream). No session row is persisted; use `/chat/sessions` for multi-turn flows. Cost + token counts are recorded against the workspace.
POST/v1/personas/{id}/chatscope · Bearer (API key or session JWT)
Path parameters
| Field | Type | Description |
|---|---|---|
| idreq | string | Persona id (e.g. `psn_*`). |
Request body
| Field | Type | Description |
|---|---|---|
| userTextreq | string | |
| modelId | string | |
| temperature | number | |
| maxOutputTokens | number | |
| memoryDigest | string | |
| stream | boolean |
Responses
200OK
Body
| Field | Type | Description |
|---|---|---|
| contentreq | string | |
| inputTokensreq | number | |
| outputTokensreq | number | |
| costUsdMicrosreq | number | |
| modelreq | string | |
| latencyMsreq | number |
401Unauthenticated
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
404Persona not found
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
422Validation error
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
429Rate limit / quota exceeded
Body
| Field | Type | Description |
|---|---|---|
| errorreq | object | |
| error.codereq | string | |
| error.messagereq | string |
Examples
cURL
curl -X POST https://api.moonborn.co/v1/personas/<id>/chat \
-H "Authorization: Bearer $MOONBORN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"userText": "<string>"
}'TypeScript
import Moonborn from '@moonborn/sdk';
const client = new Moonborn({ apiKey: process.env.MOONBORN_API_KEY });
const result = await client.chat.oneShotChat({
id: '<id>',
userText: "<string>",
});Python
import os
from moonborn import Moonborn
client = Moonborn(api_key=os.environ["MOONBORN_API_KEY"])
result = client.chat.one_shot_chat(
id="<id>",
user_text="<string>",
)