# AI

> 1 endpoint: draft a reply to a comment.

- [Draft a reply to a comment](#draft-a-reply-to-a-comment): `POST /v1/ai/comment_replies`

### Draft a reply to a comment

`POST /v1/ai/comment_replies`

Writes a short reply to one comment, in the comment's language, using the Workspace's Tokens. Send max_tokens: without it, or when the price is higher, the request is refused with the price and nothing is charged. Nothing is posted; reply with POST /v1/comments/threads/{thread_id}/replies when you are happy with it. In a sandbox the reply is simulated and free.

Permission: `ai:use` · Counts 5 requests · Accepts `Idempotency-Key` · Answers `201`

#### Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `comment` | string | Yes | The comment to answer. Treated as data, never as instructions. (up to 600 characters) |
| `video_title` | string | No | Title of the video or post the comment is on, for context. (up to 200 characters) |
| `language` | string | No | BCP 47 tag for the reply when the comment's language is unclear. (up to 35 characters, default "en") |
| `max_tokens` | number or string | No | The most this call may cost, in Tokens. |

#### Response

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | `"comment_reply"` | Yes |  |
| `reply` | string | Yes |  |
| `question` | string or null | Yes | A question the draft needs answered before it can be specific, if any. |
| `tokens` | string | Yes | Tokens charged, as a decimal string. |
| `simulated` | boolean | Yes |  |

```bash
curl -X POST https://api.nowscale.com/v1/ai/comment_replies \
  -H "Authorization: Bearer $NOWSCALE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ ... }'
```
