> For the complete documentation index, see [llms.txt](https://docs.fastrouter.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fastrouter.ai/api-reference/embeddings.md).

# Embeddings

## Create Embeddings

> Creates vector embeddings for text input. Supports models from OpenAI, Google, and DeepInfra. Compatible with OpenAI SDK.

```json
{"openapi":"3.1.0","info":{"title":"FastRouter API Reference","version":"1.0.0"},"tags":[{"name":"Embeddings","description":"Create vector embeddings for text using various embedding models."}],"servers":[{"url":"https://api.fastrouter.ai","description":"Production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"FastRouter API Key. Get yours at https://fastrouter.ai\n\nFormat: `Authorization: Bearer YOUR_API_KEY`"}},"responses":{"UnauthorizedError":{"description":"Invalid Credentials - Your API key is invalid, missing, or disabled. Check your credentials.\n\nNote: the 401 error body uses `code`, `message`, `param`, and `type` (there is no `status` field), and `type` is `invalid_request_error`.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"param":{"type":"string","nullable":true},"code":{"type":"string"}}}}}}}},"RateLimitError":{"description":"Rate Limited - You have exceeded your request limits (TPM/RPM). Slow down or increase your limits.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}}}},"paths":{"/api/v1/embeddings":{"post":{"operationId":"createEmbedding","tags":["Embeddings"],"summary":"Create Embeddings","description":"Creates vector embeddings for text input. Supports models from OpenAI, Google, and DeepInfra. Compatible with OpenAI SDK.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","input"],"properties":{"model":{"type":"string","description":"The fully qualified model slug. Choose from supported models (openai/text-embedding-3-small, openai/text-embedding-3-large, openai/text-embedding-ada-002, google/gemini-embedding-001, deepinfra/intfloat-e5-base-v2)","enum":["openai/text-embedding-3-small","openai/text-embedding-3-large","openai/text-embedding-ada-002","google/gemini-embedding-001","deepinfra/intfloat-e5-base-v2"]},"input":{"oneOf":[{"type":"string","description":"Single text string to embed"},{"type":"array","items":{"type":"string"},"description":"Array of text strings to embed (batch processing)"}],"description":"The input text or list of text items to embed. Can be a single string or array of strings for batch processing."},"dimensions":{"type":"integer","minimum":1,"description":"Optional: Requested embedding size/dimensions. Supported only in text-embedding-3 series and newer models. Allows you to reduce embedding size for efficiency."},"encoding_format":{"type":"string","enum":["float","base64"],"default":"float","description":"Format for the embedding vector. 'float' returns array of numbers, 'base64' returns base64-encoded string."},"user":{"type":"string","description":"Optional: A unique identifier representing your end-user, for monitoring and abuse detection."}}}}}},"responses":{"200":{"description":"Embeddings created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"object":{"type":"string","description":"Object type, always 'list'"},"data":{"type":"array","description":"Array of embedding objects","items":{"type":"object","properties":{"object":{"type":"string","description":"Object type, always 'embedding'"},"index":{"type":"integer","description":"Index of the embedding in the input array"},"embedding":{"type":"array","items":{"type":"number"},"description":"Vector representation of the input text"}}}},"model":{"type":"string","description":"Model used for embedding generation"},"usage":{"type":"object","description":"Token usage statistics","properties":{"prompt_tokens":{"type":"integer","description":"Number of tokens in the input"},"total_tokens":{"type":"integer","description":"Total tokens used (same as prompt_tokens for embeddings)"}}}}}}}},"400":{"description":"Bad Request - Invalid parameters or model"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"429":{"$ref":"#/components/responses/RateLimitError"},"500":{"description":"Internal Server Error"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.fastrouter.ai/api-reference/embeddings.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
