# Alt text

> Generate an alt text string, 1 to 160 characters, for an existing image.

`POST /image/alt` writes alt text for one image. There is no `model` field.
Mynth picks the model and keeps it current. The result is a string of 1 to
160 characters, written to be read aloud.

**SDK**

```ts
import Mynth from "@mynthio/sdk";

const mynth = new Mynth();

const result = await mynth.image.alt({ url: "https://cdn.example.com/lighthouse.png" });

console.log(result.alt);
```

**CLI**

```bash
npx @mynthio/cli image alt https://cdn.example.com/lighthouse.png
```

**REST**

```bash
curl https://api.mynth.io/image/alt \
  -H "Authorization: Bearer $MYNTH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://cdn.example.com/lighthouse.png"}'
```

The body takes only `url`, a public http(s) image URL. The SDK also accepts a
`file`, and the CLI a local path. Both upload it first. The request does not
take `webhook` or `metadata`, and the response has no `pat_` token.

The REST call returns a task. The task's `result` is:

```json
{ "alt": "A white lighthouse on dark rocks, lit by an orange sunset sky" }
```

A URL Mynth cannot fetch fails the task with `FETCH_FAILED`.

## Price

$0.0004 per image, charged only when the task succeeds. See
[pricing](https://mynth.io/docs/pricing.md#tool-prices).

## Next steps

- [Rate images](https://mynth.io/docs/guides/rate-images.md): classify the same image instead of describing it.
- [Review images](https://mynth.io/docs/guides/review-images.md): score it and list defects.
