Open app
Moonborn — Developers

SDKs

TypeScript and Python SDKs ship today. Go, Ruby, Rust, and Elixir are next. For the full reference, drop into.

Available today

  • TypeScriptv1, stable. Node 18+ and browsers. Full type coverage from the OpenAPI spec.
  • Pythonv1, stable. Python 3.10+. Sync and async clients.

Both SDKs map 1:1 to the REST surface — there is no SDK-only feature and no REST-only feature.

TypeScript

pnpm add @moonborn/sdk
import Moonborn from '@moonborn/sdk';
 
const client = new Moonborn({
 apiKey: process.env.MOONBORN_API_KEY,
});
 
const persona = await client.personas.create({
 intent: 'A bookshop owner who reads more than she sells.',
});
 
const session = await client.chat.sessions.create({ personaId: persona.id });
const stream = await client.chat.messages.stream({
 sessionId: session.id,
 content: 'Tell me a quiet truth.',
});
 
for await (const chunk of stream) {
 process.stdout.write(chunk.delta);
}

Auth via constructor or environment variable. Streaming is an AsyncIterable of typed delta chunks.

Python

pip install moonborn
import os
from moonborn import Moonborn
 
client = Moonborn(api_key=os.environ["MOONBORN_API_KEY"])
 
persona = client.personas.create(
 intent="A bookshop owner who reads more than she sells."
)
 
session = client.chat.sessions.create(persona_id=persona.id)
 
for chunk in client.chat.messages.stream(session_id=session.id, content="Tell me a quiet truth."):
 print(chunk.delta, end="", flush=True)

An async variant lives at moonborn.aio with the same surface.

Coming soon

  • Go, Ruby, Rust, Elixir — generated from the OpenAPI spec, on the same release cadence as the API.

Until they land, the OpenAPI spec at /openapi.json generates working clients for every major language via openapi-generator or your preferred toolchain.

Bring your own HTTP client

Every endpoint is plain JSON over HTTPS, bearer-authenticated. If you'd rather not add an SDK, the REST surface is the same surface the SDKs wrap.

curl -X POST https://api.moonborn.co/v1/personas \
 -H "Authorization: Bearer $MOONBORN_API_KEY" \
 -H "Content-Type: application/json" \
 -d '{"intent": "..."}'

Next