Skip to main content
The server exposes 46 tools across seven areas. You rarely need to name one. Describe what you want, and the assistant picks the tools and chains them. The names are here so you can recognise what it’s doing and steer it when it picks the wrong one.

What costs credits

Four tools spend one credit per call, the same as generating or AI-editing in the app: If the AI step itself fails, the credit is refunded. Everything else is free, including AI analysis such as score_email, improve_email, apply_dark_mode, create_segment, and import_brand. Every call, free or not, counts toward the per-minute call budget. See Credits and limits.

Emails

edit_email saves only if nobody changed the email while it worked. If you or a teammate saved it in the editor meanwhile, your save is kept, the edit is discarded, the credit is refunded, and the assistant is told to read the email again.

Campaigns

These tools work only on draft campaigns. None of them sends anything. When get_campaign_state says the campaign is ready, open it in the app to send it or confirm the schedule.
To target more than 5,000 contacts, have the assistant create a segment with create_segment and target that instead. A segment has no size limit, and it’s evaluated at send time, so contacts who join later are included.

Audience

Brands

Analytics

All read-only. The summary, series, and campaign-table tools take a number of days to look back over.

Templates

To start from a template, have the assistant pass its ID to create_email.

ESP

These work only after you’ve connected an ESP in the app. Otherwise they reply that the provider isn’t connected. Connecting stays a human step.

generate_email in detail

It returns two blocks: the finished email as ready-to-send HTML, and a metadata block with email_id, subject, preheader, score, subject_variants, and dark_mode. The email is saved in your workspace, so the assistant can carry on with edit_email, score_email, or select_email using that email_id.
generate_email doesn’t take a format. For the editable MJML source, follow up with get_email.
Generation takes roughly one to three minutes. The server sends progress pings throughout so your client doesn’t drop the connection. Expect a pause, not a hang.

Ask for good results

The same things that make a good prompt in the app make a good one here: who it’s going to, what you want them to do, and the tone. A brand handles the look.
The assistant can chain the steps for you:
Detail in the first request beats a chain of regenerations. For small changes, ask for an edit (“tighten the headline”), not a new email. Both cost one credit, but an edit keeps everything you already liked. Asking for “a few variations” spends a credit on each one, so say how many you want.

Troubleshooting

Mention AlpacaRelay or the tool by name, such as “use generate_email to…”. Assistants sometimes write their own draft when the request sounds like ordinary writing.
The per-minute call budget is spent. The message says how many seconds to wait. Long agent loops over many contacts or emails hit this first, so ask for one bulk call (import_contacts) instead of many small ones.
Three generations run at once per workspace, counted across every key and sign-in. A fourth is refused until one finishes, and extra keys don’t raise the limit. Only generate_email counts toward it.
Generation can take minutes. If your client has a configurable tool timeout, raise it to at least six minutes. If it gives up anyway, the email usually still finishes and appears in your workspace, so check list_emails before asking again.
It has left draft, because it was sent or scheduled in the app. Create a new campaign, or edit this one in the app.
Top up under Settings → Billing & usage. Credits are shared with the app and the REST API. There’s no separate API allowance.