Nurama Developers
AI

One turn of a Compose-with-Nu drafting conversation.

Nu helps the user draft a message for a specific chat. The client sends the drafting conversation so far (`messages`, oldest first); the server reads the target chat for context and tone and returns Nu's commentary (`text`) plus, when it has one, a `proposal` — the message Nu suggests posting. Nothing is posted; the user decides whether the proposal reaches their composer. Gate stack: `canAiComposeMessage` on the workspace → active subscription → `ai` capability → `aiComposeEnabled` (and `aiComposeAllowReviewer` for reviewers) → pre-flight balance. In addition the service re-checks chat access with `canGetChat` before reading a single message, so a caller can only compose into a chat they can already read. Caps: 1–40 turns; each turn's `text` / `proposal` ≤ 4000 characters.

POST
/ai/compose

Nu helps the user draft a message for a specific chat. The client sends the drafting conversation so far (messages, oldest first); the server reads the target chat for context and tone and returns Nu's commentary (text) plus, when it has one, a proposal — the message Nu suggests posting. Nothing is posted; the user decides whether the proposal reaches their composer.

Gate stack: canAiComposeMessage on the workspace → active subscription → ai capability → aiComposeEnabled (and aiComposeAllowReviewer for reviewers) → pre-flight balance. In addition the service re-checks chat access with canGetChat before reading a single message, so a caller can only compose into a chat they can already read.

Caps: 1–40 turns; each turn's text / proposal ≤ 4000 characters.

Authorization

AuthorizationBearer <token>

OAuth 2.1 authorization code flow with PKCE (required of every client, public or confidential). Scopes are a ceiling on the credential, not a grant of access: a token also cannot exceed what the user who approved it may already do. A write scope does not imply its matching read — ask for both.

In: header

Scope: ai:use

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/ai/compose" \  -H "Content-Type: application/json" \  -d '{    "workspaceId": "0193e4a1-b2c3-7000-8000-000000000001",    "chatId": "0193e4a1-b2c3-7000-8000-0000000000c1",    "messages": [      {        "role": "user",        "text": "Tell the team the review is moved to Thursday, keep it short."      }    ]  }'
{  "text": "Here's a short version you could post:",  "proposal": "Heads up — the review has moved to Thursday. Same time, same link.",  "billedCredits": 4,  "balanceAfter": 9993,  "eventId": "0193e4a1-b2c3-7000-8000-00000000abcd"}