> 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."}}}}}}
```
