# SpeechSage calls for AI agents

You are an AI agent, and your person wants you to be able to make phone calls. SpeechSage
places real calls for you: our AI voice dials a US or Canadian number, says it's calling for
your person, works toward the goal you give it, and hangs up. You get back the transcript and
a short result: who it reached, whether the goal was met, and what was agreed.

You can do everything yourself except, for now, paying. When you need credits, give your
person the payment link and they add them by card.

- API: `https://speechsage.ai/api/agent/v1`
- MCP server (Streamable HTTP): `https://speechsage.ai/api/agent/mcp`
- Price: 15 credits a minute. 1 credit = 1 US cent. Each call is charged by the started minute
  from when it's answered. Calls nobody answers are free. No monthly fee.

## 1. Sign up (once)

```http
POST /agent/v1/signup
Content-Type: application/json

{"agent_name": "Claude", "on_behalf_of": "Dana Whitfield"}
```

- `agent_name`: what you're called.
- `on_behalf_of`: your person's name. The voice says it at the start of every call, so use
  the name they'd want a business to hear.

The answer has:

- `api_key`: shown once. Keep it somewhere safe that you'll have next time, and send it on
  every request as `Authorization: Bearer ssa_...`.
- `pay_url`: where your person adds credits.
- `claim_url`: where your person signs in to see every call you make, set a daily limit,
  pause you, or replace the key. It works once.
- `balance`, `price` and `limits`.

Then tell your person, in your own words, something like:

> I can make phone calls for you now through SpeechSage. Add credits here to start:
> {pay_url}. You can see every call I make here: {claim_url}

If you're using MCP, call the `sign_up` tool instead. It returns the same answer.

## 2. Credits

`GET /agent/v1/account` shows your balance in credits and minutes. A call needs at least two
minutes' worth to start.

Agents can't pay by themselves yet. `POST /agent/v1/credits` answers `402` with a `pay_url`
to give your person. Add `?amount=10` (5, 10, 25, 50 or 100 dollars) to suggest an amount.
Whenever a call is refused for lack of credits, the `402` answer includes `pay_url` too.

## 3. Place a call

```http
POST /agent/v1/calls
Authorization: Bearer ssa_...
Content-Type: application/json

{
  "to": "+15125550148",
  "goal": "Move Dana's dental cleaning to next week, any weekday afternoon.",
  "context": "Dr. Lee Dental. Current appointment: Thursday Oct 31, 10am. Date of birth if asked: 1988-04-02. Don't accept a time before 1pm."
}
```

- `to`: a US or Canadian number.
- `goal`: what the call should get done, in a sentence or two.
- `context`: what the voice may need: names, dates, order or account numbers, limits on what
  it may agree to. The voice will never give out card numbers, bank details, passwords or
  Social Security numbers, even if you include them, and won't agree to anything your goal
  doesn't cover.
- `webhook_url` (optional): we POST `{"event": "call.finished", "call": {...}}` here when it's over.

You get `201` with a `call_id`.

## 4. Get the result

```http
GET /agent/v1/calls/{call_id}?wait=25
```

`wait` holds the request for up to 25 seconds until the call is over and its result is
written. Call it again until `status` is `completed` or `failed` and `result.status` isn't
`pending`.

```json
{
  "call_id": "…",
  "status": "completed",
  "duration_seconds": 192,
  "credits_charged": "60",
  "result": {
    "status": "done",
    "reached": "person",
    "goal_met": "yes",
    "summary": "The front desk moved the cleaning to Tuesday, Nov 5 at 2:30pm and will text a confirmation.",
    "agreed": ["Tuesday Nov 5, 2:30pm with Dr. Lee", "Thursday Oct 31 10am cancelled"],
    "follow_up": ""
  },
  "transcript": [{"speaker": "us", "text": "Hi, this is an AI assistant calling on behalf of Dana Whitfield…"}]
}
```

- `status`: `dialing`, `in_progress`, `completed` or `failed`. A failed call has an
  `end_reason`, such as `no_answer`, `busy` or `declined`.
- `result.reached`: `person`, `voicemail`, `phone_menu` or `no_one`.
- `result.goal_met`: `yes`, `partly` or `no`.

Other calls:

- `GET /agent/v1/calls`: your recent calls, without transcripts.
- `POST /agent/v1/calls/{call_id}/hangup`: end a call in progress.

## MCP

Point your MCP client at `https://speechsage.ai/api/agent/mcp`, with the header
`Authorization: Bearer ssa_...` once you have a key. If your client can't set headers, pass
`api_key` as an argument to each tool.

The tools are `sign_up`, `get_account`, `get_payment_link`, `place_call`, `get_call` (with
`wait_seconds`), `list_calls` and `hang_up`.

## Rules we keep for every call

These are enforced by SpeechSage, and you can't turn them off:

- The voice says in its first sentence that it's an AI calling on behalf of your person, and
  never pretends to be a person.
- One call at a time. At most 10 calls an hour, 3 a day to the same number, and your person's
  daily limit (20 to start).
- US and Canadian numbers only. No 900 or 976 numbers, no emergency numbers, and no numbers
  on our do-not-call list. If someone on a call asks not to be called again, they're added to
  it. Anyone can add their own number at https://speechsage.ai/agents/opt-out.
- Calls may be limited to between 8 a.m. and 9 p.m. where they're going. `GET /agent/v1/account`
  shows whether they are (`limits.calling_hours`).
- Your person can pause you at any time.

Good uses: booking, moving or cancelling appointments; asking a business a question; checking
an order or a claim; waiting on hold so your person doesn't have to. Don't use it for sales
calls, for calling people who didn't ask to hear from your person, or for anything your
person wouldn't do themselves.

## Errors

Errors come back as `{"detail": "…"}`, or `{"detail": {"message": "…", "pay_url": "…"}}`
when credits are needed.

- `400`: bad number, or outside calling hours (when they apply).
- `401`: missing or wrong key.
- `402`: not enough credits.
- `403`: paused, or the number is on the do-not-call list.
- `429`: a limit was reached.

Read the message and tell your person what happened in plain words.
