> ## Documentation Index
> Fetch the complete documentation index at: https://docs.floodgate.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Embeddings

> Generate embedding vectors from a string or batch of strings. Read indexes and token usage, and check which dimensions, encodings and limits are documented.

Generate embedding vectors with Floodgate's compatible embeddings operation. Use the accepted model ID and a routing group that exposes this exact API in [Model Square](https://floodgate.dev/models).

## Submit

Send `POST /v1/embeddings` with your API key. `input` accepts one string or an array of strings:

```bash theme={null}
curl --fail-with-body https://api.floodgate.dev/v1/embeddings \
  -H "Authorization: Bearer $FLOODGATE_API_KEY" -H 'Content-Type: application/json' \
  -d '{"model":"text-embedding-3-small","input":["Hello!","A second document."]}'
```

The response is synchronous. No task polling or video download is needed.

```json theme={null}
{"object":"list","data":[{"object":"embedding","index":0,"embedding":[0.018,-0.027,0.004]}],"model":"text-embedding-3-small","usage":{"prompt_tokens":2,"total_tokens":2}}
```

This sample shows one input and a shortened vector. Read vectors from `data[].embedding` and match each `data[].index` to its input. Read token usage separately from the vectors.

```javascript theme={null}
const vectors = data.data.map(item => ({ index: item.index, embedding: item.embedding }));
console.log({ vectors, usage: data.usage });
```

## Parameters and limits

| Field | Required | Meaning |
| - | - | - |
| `model` | Yes | Accepted API model ID |
| `input` | Yes | String or string array |
| `dimensions` | No | Use only when the selected model/group publishes allowed dimensions |
| `encoding_format` | No | Use only when the selected model/group publishes allowed encodings |

Current compatible metadata leaves input-count limits, input-token limits, dimensions and encoding choices undocumented. Do not borrow another model's limits or assume a default encoding.

Native Gemini embedding operations and reranking do not have reviewed contracts in this reference. There is no chat or embedding fallback for `/v1/rerank`. Embeddings return vectors, not relevance scores.

## Errors and billing

Check required fields and published limits on `400`, the API key on `401`, group access and funds on `403`, and rate limits on `429`.

Embedding usage reports `prompt_tokens` and `total_tokens`. Pricing depends on the selected model/group; see [Model Square](https://floodgate.dev/models). The response's indexes and usage apply to the submitted inputs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.