Free Codestral API
Mistral’s specialist code-completion model — free to try.
Codestral is Mistral’s dedicated code model, strong at fill-in-the-middle completion across many languages — a great free backend for IDE autocomplete. Available on Mistral’s free plan.
Quickstart — Codestral on Mistral AI
from openai import OpenAI
client = OpenAI(
base_url="https://api.mistral.ai/v1",
api_key="YOUR_FREE_KEY" # from Mistral AI
)
resp = client.chat.completions.create(
model="mistral-small-latest", # Codestral on Mistral AI
messages=[{"role": "user", "content": "Hello!"}]
)
print(resp.choices[0].message.content)Providers offering Codestral free
Create your own key on any of these. Click through for setup, limits and code.
Free Codestral API — FAQ
Is Codestral free to use via API?+
Yes. 1 providers in our directory host Codestral with free access, starting with Mistral AI. You create your own free key on the provider’s site.
Which provider is best for a free Codestral API key?+
Mistral AI — European frontier models with a free “Experiment” tier. See the full comparison below to match limits and speed to your needs.
How do I call Codestral with the OpenAI SDK?+
Set your base URL to your chosen provider’s endpoint (shown on each provider page), use your free key, and pass a Codestral model id such as "codestral-latest".