API Reference
API reference
Full method reference for JavaScript SDK, React hooks, and REST API.
SDK package
Install: npm install @amarsia/sdk · npm ↗
Initialize once, use everywhere:
import { amarsia } from "@amarsia/sdk"
const client = amarsia.init({
apiKey: process.env.AMARSIA_API_KEY!,
deploymentId: process.env.AMARSIA_DEPLOYMENT_ID!,
})Reference pages
Authentication
API keys and secure usage.
Runner API
One-shot and streaming generation.
Conversation API
Stateful chat and history methods.
Errors
Error shape, status codes, and retry rules.
Universal request shape
{
"content": [
{ "type": "text", "text": "Your input here" }
],
"variables": {
"VARIABLE_NAME": "value"
}
}| Field | Type | Required | Meaning |
|---|---|---|---|
content | array | Yes | Input items — text, image, video, audio, url |
variables | object | No | Values injected into assistant instructions |
meta | object | No | Custom labels for conversation tracking |
Universal response shape
{
"content": "Assistant output...",
"model": "model-name",
"input_tokens": 42,
"output_tokens": 61
}