# Text embeddings

## Overview

Embeds one or more nonempty texts and returns one vector per input, with token usage.

Indexed embedding vectors, model, provider, and verified token usage.

## Input

These go in the `input` object of the run request.

| Field | Type   | Required | Description                                                 |
|-------|--------|----------|-------------------------------------------------------------|
| input | array  | Yes      | One or more nonempty text strings.                          |
| model | string | No       | Embedding model.<br>Allowed: text-embedding-3-small, text-embedding-3-large<br>Default: `"text-embedding-3-small"` |

Requests up to 1 MB.

## Example

Use your own API key and a saved idempotency key for each new job. Replace image or media placeholders with your own publicly reachable HTTPS URLs. Keep the same key and request body when recovering a timeout.

```bash
# Set once per job; reuse this key and the identical body after a timeout.
: "${AGENTSKY_IDEMPOTENCY_KEY:?Set a unique, saved key for this job}"
curl --fail-with-body https://gateway.agentsky.dev/v1/run \
  -H "authorization: Bearer $AGENTSKY_API_KEY" \
  -H "content-type: application/json" \
  -H "Idempotency-Key: $AGENTSKY_IDEMPOTENCY_KEY" \
  -d '{"provider":"embedding","endpoint":"openai","input":{"input":["Search result text"],"model":"text-embedding-3-small"}}'
# If status is READY/RUNNING, poll GET /v1/runs/{runId} with the same API key.
```

## Pricing

— per token using your plan when signed in. Read the final customer charge from price.amount.value after the run finishes. A RUNNING response is not the final bill.

## Questions

### What does Text embeddings do?

### What does Text embeddings take?

### What are the limits on Text embeddings?

### How do I retry safely and check the final charge?
