# Generate post drafts

Use Beacon AI credits to generate editable post drafts for one or more providers.

This operation requires **Generate with AI** access. AI generation uses workspace credits.

An idempotency key identifies one write request. Reuse the key only when you repeat that request.

## Generate shared copy

```ts
const result = await beacon.ai.generateDrafts(
  {
    brief: "Introduce the new weekly planning view.",
    confirmed: true,
    destinations: [{ maxCharacters: 280, provider: "x" }],
    language: "English",
    optionCount: 1,
    tone: "confident",
  },
  { idempotencyKey: "ai-draft-2026-08-28-planning" },
);
```

## Read the credit result

```ts
console.log(result.billing.creditCost);
console.log(result.billing.balance);
```

Set `confirmed` to `false` when your interface still needs user confirmation. Beacon then returns `approval_required` without generation.

A repeated confirmed request must use the same idempotency key. A requested regeneration is a new operation and can use more credits.
