# Codestral Embed - Core.Today AI API > Mistral's code embedding model over the direct Mistral API - vectors tuned for code search, retrieval for coding agents and duplicate detection. 1,536 dimensions by default, adjustable up to 3,072 with output_dimension. Billed on input tokens only. - **Provider**: Mistral AI - **Model ID**: codestral-embed-2505 - **Category**: LLM - **Credits**: 0.28 per 1K tokens - **Speed**: Fast - **Quality**: High ## Model Specifications - **Context Window**: 8K tokens - **Training Cutoff**: n/a - **Supported Formats**: text - **Compatible SDK**: OpenAI ### Token Pricing (per 1M tokens) - **Input Tokens**: 278.7 credits ($0.19) - **Output Tokens**: not charged — billed on input tokens only ## Features - Embeddings specialised for source code - 1,536 dimensions by default, 1 to 3,072 with output_dimension - output_dtype: float, int8, uint8, binary, ubinary - 8,192-token input per item - OpenAI-compatible API (embeddings) via /llm/mistral/v1 ## Use Cases - Code search across repositories - Retrieval for coding assistants and agents - Duplicate and near-duplicate code detection - Clustering code by function ## API Endpoint Base URL: https://api.core.today Endpoint: POST /llm/mistral/v1/embeddings ## Authentication Header: Authorization: Bearer YOUR_API_KEY Note: LLM endpoints use OpenAI-compatible format with Authorization Bearer token. ## Input Parameters ### Required - **input**: string | array - Code or text, or an array of them, to embed. Max 8,192 tokens per item. - **model**: string (default: codestral-embed-2505) - Model identifier. The alias codestral-embed is accepted and pinned to codestral-embed-2505. ### Optional - **output_dimension**: integer (default: 1536) - Size of the returned vectors, up to 3,072. Note the name: the OpenAI-style `dimensions` field is rejected. - **output_dtype**: string (default: float) - Element type of the returned vectors. Options: float, int8, uint8, binary, ubinary ## Examples ### Embeddings Returns data[].embedding for each input, in order. ```json { "model": "codestral-embed-2505", "input": [ "def add(a, b):\n return a + b", "function add(a, b) { return a + b; }" ], "output_dimension": 1024 } ``` ## Response Format ```json { "id": "chatcmpl-abc123", "object": "chat.completion", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Response text here" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 100, "completion_tokens": 50, "total_tokens": 150 } } ``` ## Tips - Works with the OpenAI SDK - set base_url to https://api.core.today/llm/mistral/v1 and use your cdt_ API key - Use the same model for indexing and querying - vectors from different models are not comparable - Send several texts in one request (input as an array) for efficiency - Max input: 8,192 tokens per item - split long documents into chunks first - Set the vector size with output_dimension (up to 3,072), not dimensions - with the OpenAI SDK pass it through extra_body - Smaller output_dimension or int8/binary output_dtype cut storage at some cost in retrieval quality ## Documentation https://docs.mistral.ai/models/codestral-embed-25-05