Mistral: Codestral Embed 2505 API Reference

Quick Start

Welcome to Infron AI — your unified gateway to cutting-edge language, reasoning, and multimodal models. This guide will walk you through setting up your environment, making basic API calls, and exploring advanced features.


Setup your API Key

To begin using Infron AI, you first need to create an account and generate your API Key.

Once you have your API key, set it as an environment variable in your runtime environment. This allows your applications to securely access Infron’s API.

export INFRON_KEY="YOUR_API_KEY"

You can verify the variable is set correctly by running:

echo $INFRON_KEY

If it prints your API key, you’re ready to start making requests.


Submit a demo request

You can interact with Infron AI through two primary methods: direct API calls or using the OpenAI SDK.

Basic Request
import requests

response = requests.post(
  "https://llm.onerouter.pro/v1/embeddings",
  headers={
    "Authorization": f"Bearer {INFRON_KEY}",
    "Content-Type": "application/json",
  },
  json={
    "model": "mistral/codestral-embed-2505",
    "input": "The quick brown fox jumps over the lazy dog"
  }
)

data = response.json()
embedding = data["data"][0]["embedding"]
print(f"Embedding dimension: {len(embedding)}")

To generate embeddings, send a POST request to /embeddings with your text input and chosen model.


Batch Processing

You can generate embeddings for multiple texts in a single request by passing an array of strings:

import requests

response = requests.post(
  "https://llm.onerouter.pro/v1/embeddings",
  headers={
    "Authorization": f"Bearer {INFRON_KEY}",
    "Content-Type": "application/json",
  },
  json={
    "model": "mistral/codestral-embed-2505",
    "input": [
      "Machine learning is a subset of artificial intelligence",
      "Deep learning uses neural networks with multiple layers",
      "Natural language processing enables computers to understand text"
    ]
  }
)

data = response.json()
for i, item in enumerate(data["data"]):
  print(f"Embedding {i}: {len(item['embedding'])} dimensions")

How Reranker Works

A reranker, given a query and many documents, returns the (ranks of) relevancy between the query and documents. The documents oftentimes are the preliminary results from an embedding-based retrieval system, and the reranker refines the ranks of these candidate documents and provides more accurate relevancy scores.

Unlike embedding models that encode queries and documents separately, rerankers are cross-encoders that jointly process a pair of query and document, enabling more accurate relevancy prediction. Thus, it is a common practice to apply a reranker on the top candidates retrieved with embedding-based search (or with lexical search algorithms such as BM25 and TF-IDF).


Infron AI is compatible with a wide range of models covering various domains such as text generation, reasoning, coding, and multimodal processing. Refer to the official model catalog to explore all available options.


Next Steps:

  • Try customizing prompts for your use case.
  • Explore streaming responses for real-time applications.
  • Combine structured outputs and multimodal inputs for rich, dynamic experiences.

Your journey with Infron AI starts here — build smarter, faster, and more capable AI applications today.