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

# Embeddings

## Create an embedding

> This endpoint creates an embedding using the specified model.

```json
{"openapi":"3.0.0","info":{"title":"Cortecs Embeddings API","version":"1.0.0"},"servers":[{"url":"https://api.cortecs.ai/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"EmbeddingRequest":{"type":"object","description":"A request object for generating embeddings. This object contains suggested parameters to generate an embedding from the specified model; however, you may include other parameters as required. Note that not all providers support the same set of parameters. Adding unsupported or unnecessary parameters can cause requests to fail or limit the providers able to process them.\n","properties":{"preference":{"type":"string","description":"The provider preference for handling the request.","enum":["speed","cost","balanced"]},"allowed_providers":{"type":"array","items":{"type":"string"},"description":"The providers that are allowed to be used for the completion.","nullable":true},"eu_native":{"type":"boolean","description":"Whether to consider only providers based and regulated withing the EU. Even when false, all our endpoints are GDPR compliant.","nullable":true},"allow_quantization":{"type":"boolean","description":"Whether to allow quantized endpoints.","nullable":true},"allow_zero_data_retention":{"type":"boolean","description":"Whether to use only ZDR providers.","nullable":true},"enable_model_fallback":{"type":"boolean","description":"Whether to allow model fallback when a model is currently unavailable.","nullable":true},"fallbacks":{"type":"array","items":{"type":"string"},"description":"The providers that are allowed to be used for the completion.","nullable":true},"model":{"type":"string","description":"The model to use for the embedding."},"input":{"oneOf":[{"type":"string","description":"A single input to embed."},{"type":"array","items":{"type":"string"},"description":"A list of inputs to embed."}]},"encoding_format":{"type":"string","description":"The encoding to use for the output.","enum":["float","base64"],"default":"float"}}},"EmbeddingResponse":{"type":"object","properties":{"id":{"type":"string","description":"The unique identifier for the completion"},"object":{"type":"string","description":"The type of object returned"},"created":{"type":"integer","description":"The timestamp when the completion was created"},"provider":{"type":"string","description":"The provider that generated the completion"},"model":{"type":"string","description":"The model that generated the embedding"},"data":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer","description":"The index of the choice"},"object":{"type":"string","description":"The type of object returned"},"embedding":{"type":"array","items":{"type":"number"},"description":"The embedding"}}}},"usage":{"type":"object","description":"Token usage information.","properties":{"prompt_tokens":{"type":"integer","description":"Number of input tokens"},"completion_tokens":{"type":"integer","description":"Since embeddings are not tokens, this is always 0"},"total_tokens":{"type":"integer","description":"Total number of tokens used"}}}}}}},"paths":{"/embeddings":{"post":{"summary":"Create an embedding","description":"This endpoint creates an embedding using the specified model.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingRequest"}}}},"responses":{"200":{"description":"An embedding.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingResponse"}}}},"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.cortecs.ai/api-overview/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.
