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

# Embeddings

## Create Embedding

> OpenAI-compatible embeddings endpoint.\
> \
> Authentication modes:\
> \- Master key + user field: Use specified user (must exist)\
> \- API key + user field: Use specified user (must exist)\
> \- API key without user field: Use the shared "default" user\
> \
> A priced response carries its cost on \`usage\` as \`cost\_usd\` (a six-decimal\
> USD string) and \`pricing\_source\`, as a chat completion does; an unpriced one\
> carries neither.

```json
{"openapi":"3.1.0","info":{"title":"otari","version":"0.33.0"},"security":[{"ApiKeyAuth":[]},{"XApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"description":"Enter your API key here (sent as Otari-Key header).","in":"header","name":"Otari-Key","type":"apiKey"},"XApiKeyAuth":{"description":"Anthropic-native clients send credentials here (no Bearer prefix).","in":"header","name":"x-api-key","type":"apiKey"}},"schemas":{"EmbeddingRequest":{"description":"OpenAI-compatible embedding request.","properties":{"dimensions":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Dimensions"},"encoding_format":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Encoding Format"},"input":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"}],"description":"Input text to embed","title":"Input"},"input_type":{"anyOf":[{"maxLength":64,"type":"string"},{"type":"null"}],"description":"What the input will be used for, for providers whose embedding depends on it: Cohere (`search_document`, `search_query`, `classification`, `clustering`, `image`) and Voyage (`query`, `document`). The provider validates the value. Any other provider answers 400, rather than embedding the input as if the field were absent.","title":"Input Type"},"model":{"title":"Model","type":"string"},"user":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User"}},"required":["model","input"],"title":"EmbeddingRequest","type":"object"},"EmbeddingResponse":{"description":"An OpenAI-compatible embeddings response, with the gateway's inline cost on ``usage``.","properties":{"data":{"items":{"$ref":"#/components/schemas/EmbeddingData"},"title":"Data","type":"array"},"model":{"title":"Model","type":"string"},"object":{"const":"list","default":"list","title":"Object","type":"string"},"usage":{"anyOf":[{"$ref":"#/components/schemas/EmbeddingUsage"},{"type":"null"}],"description":"Absent when the provider reported no usage"}},"required":["data","model"],"title":"EmbeddingResponse","type":"object"},"EmbeddingData":{"description":"One input's embedding, in OpenAI's shape.","properties":{"embedding":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"string"}],"description":"The vector, or its base64 encoding when the request asked for `encoding_format: base64`","title":"Embedding"},"index":{"title":"Index","type":"integer"},"object":{"const":"embedding","default":"embedding","title":"Object","type":"string"}},"required":["index","embedding"],"title":"EmbeddingData","type":"object"},"EmbeddingUsage":{"description":"What an embeddings request was metered at, and what it cost.","properties":{"cost_usd":{"anyOf":[{"pattern":"^-?\\d+\\.\\d{6}$","type":"string"},{"type":"null"}],"description":"What the request cost, as a six-decimal USD string; absent when it was not priced","title":"Cost Usd"},"pricing_source":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Which rate priced the request: `organization`, `deployment` or `defaults`; absent when it was not priced","title":"Pricing Source"},"prompt_tokens":{"title":"Prompt Tokens","type":"integer"},"total_tokens":{"title":"Total Tokens","type":"integer"}},"required":["prompt_tokens","total_tokens"],"title":"EmbeddingUsage","type":"object"},"HTTPValidationError":{"properties":{"code":{"const":"invalid_request","description":"Stable error code, also sent as the Otari-Error-Code header.","title":"Code","type":"string"},"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"title":"Detail","type":"array"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"ctx":{"title":"Context","type":"object"},"input":{"title":"Input"},"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/embeddings":{"post":{"description":"OpenAI-compatible embeddings endpoint.\n\nAuthentication modes:\n- Master key + user field: Use specified user (must exist)\n- API key + user field: Use specified user (must exist)\n- API key without user field: Use the shared \"default\" user\n\nA priced response carries its cost on `usage` as `cost_usd` (a six-decimal\nUSD string) and `pricing_source`, as a chat completion does; an unpriced one\ncarries neither.","operationId":"embeddings-create_embedding","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingResponse"}}},"description":"Successful Response"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation Error"}},"summary":"Create Embedding","tags":["embeddings"]}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.otari.ai/otari/for-integrators/api-reference/embeddings.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
