Open app
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
FieldTypeDescription
idreqstringPersona id (e.g. `psn_*`).
Request body
FieldTypeDescription
userTextreqstring
modelIdstring
temperaturenumber
maxOutputTokensnumber
memoryDigeststring
streamboolean

Responses

200OK
Body
FieldTypeDescription
contentreqstring
inputTokensreqnumber
outputTokensreqnumber
costUsdMicrosreqnumber
modelreqstring
latencyMsreqnumber
401Unauthenticated
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
404Persona not found
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
422Validation error
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring
429Rate limit / quota exceeded
Body
FieldTypeDescription
errorreqobject
error.codereqstring
error.messagereqstring

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>",
)