> 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/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},"provider_order":{"type":"string","description":"Set to `custom` to try `allowed_providers` in the listed order instead of using preference-based routing.","enum":["custom"],"nullable":true},"quantizations":{"type":"array","items":{"type":"string","enum":["int4","int8","fp4","mxfp4","nvfp4","fp6","fp8","mxfp8","fp16","bf16","fp32","unknown"]},"description":"Restricts routing to endpoints whose quantization matches one of the listed values. `fp4` and `fp8` also match their family variants; `unknown` matches endpoints without a specified quantization.","nullable":true},"allow_quantization":{"type":"boolean","description":"Deprecated. Use `quantizations` instead. When `false`, excludes quantized endpoints.","deprecated":true,"nullable":true},"allow_zero_data_retention":{"type":"boolean","description":"Whether to use only ZDR providers.","nullable":true},"require_model_presets":{"type":"boolean","description":"Require a project preset alias for all model requests.","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":"An ordered list of fallback model IDs to try if the requested model fails. A nonempty list overrides the default fallback chain.","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"},"cost":{"type":"number","description":"Total cost in the unit selected by `x-cortecs-cost-unit` (credits by default; 1,000,000 credits = €1)."},"cost_details":{"type":"object","description":"Cost breakdown in the selected cost unit.","properties":{"prompt_cost":{"type":"number"},"cache_read_cost":{"type":"number"},"cache_write_cost":{"type":"number"},"completion_cost":{"type":"number"},"prompt_audio_cost":{"type":"number","description":"Cost of audio in the prompt in the selected cost unit."}}}}}}}}},"paths":{"/embeddings":{"post":{"parameters":[{"in":"header","name":"x-cortecs-cost-unit","description":"Unit for returned usage cost values. Defaults to CREDITS (1,000,000 credits = €1); EUR and USD select currency amounts.","required":false,"schema":{"type":"string","enum":["CREDITS","EUR","USD"],"default":"CREDITS"}}],"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.","headers":{},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddingResponse"}}}},"500":{"description":"Internal server error."}}}}}}
```
