Skip to main content
Core.Today
|
Mistral AIFastHigh

Codestral Embed

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.

279credits
per 1M input tokens ยท no output-token charge
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

Run it right now

Test this model instantly in the Console Playground โ€” no code required

Sign in to try

Use with AI Assistant

Copy usage instructions for Claude, ChatGPT, or other AI

Model Specifications

Context Window
8K
tokens
Training Cutoff
n/a
Compatible SDK
OpenAI

Capabilities

Vision
Function Calling
Streaming
JSON Mode
System Prompt

Token Pricing (per 1M tokens)

Token TypeCreditsUSD Equivalent
Input Tokens279$0.19
Output TokensNo charge โ€” billed on input tokens only

* 1,500 credits โ‰ˆ $1 (actual charges may vary based on usage)

Quick Start

curl -X POST "https://api.core.today/llm/mistral/v1/embeddings" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer cdt_your_api_key" \
  -d '{
  "model": "codestral-embed-2505",
  "input": [
    "def add(a, b):\n    return a + b",
    "function add(a, b) { return a + b; }"
  ],
  "output_dimension": 1024
}'

Parameters

ParameterTypeRequiredDefaultDescription
inputstring | arrayYes-Code or text, or an array of them, to embed. Max 8,192 tokens per item.
modelstringYescodestral-embed-2505Model identifier. The alias codestral-embed is accepted and pinned to codestral-embed-2505.
output_dimensionintegerNo1536Size of the returned vectors, up to 3,072. Note the name: the OpenAI-style `dimensions` field is rejected.
output_dtypestringNofloatElement type of the returned vectors.
floatint8uint8binaryubinary

Examples

Embeddings

Returns data[].embedding for each input, in order.

curl -X POST "https://api.core.today/llm/mistral/v1/embeddings" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer cdt_your_api_key" \
  -d '{
  "model": "codestral-embed-2505",
  "input": [
    "def add(a, b):\n    return a + b",
    "function add(a, b) { return a + b; }"
  ],
  "output_dimension": 1024
}'

Tips & Best Practices

1Works with the OpenAI SDK - set base_url to https://api.core.today/llm/mistral/v1 and use your cdt_ API key
2Use the same model for indexing and querying - vectors from different models are not comparable
3Send several texts in one request (input as an array) for efficiency
4Max input: 8,192 tokens per item - split long documents into chunks first
5Set the vector size with output_dimension (up to 3,072), not dimensions - with the OpenAI SDK pass it through extra_body
6Smaller output_dimension or int8/binary output_dtype cut storage at some cost in retrieval quality

Use Cases

Code search across repositories
Retrieval for coding assistants and agents
Duplicate and near-duplicate code detection
Clustering code by function