{"slug":"codestral-2508","name":"Codestral 2508","family":"mistral","family_name":"Mistral","developer":"Mistral","color":"#f2b705","status":"active","released":"2025-07-30","snapshot_of":null,"open":false,"context":256000,"max_output":8192,"knowledge_cutoff":null,"modalities":["text","file"],"output_modalities":["text"],"reasoning":false,"tools":true,"structured_output":true,"huggingface":null,"speed":143,"latency":0.29,"short":"Closed-weight code model from Mistral, released July 2025, with a 256k context window and tool calling. It has no benchmark results in the registry, so its profile rests on specifications and price.","strengths":["Input costs $0.30 per million tokens, below the registry median blend","Context window of 256k tokens","Supports tool calling and structured output","Available directly from Mistral and through OpenRouter"],"weaknesses":["No benchmark results, so capability cannot be compared with other models","Popularity ranks 178 of 194 in the registry","Largest response is capped at 8192 tokens"],"best_for":"Code-focused agents and coding tasks that need long context, tool calls and structured output on a low budget.","long":"Codestral 2508 is a closed-weight model from Mistral, released July 30, 2025. It accepts text and file inputs and offers a 256k-token context window, which is large for a model in this price range. It supports tool calling and structured output but has no reasoning mode. The registry holds no benchmark results for it, so its quality cannot be ranked against other models here, and buyers will need to test it on their own tasks.\n\nPricing is the clearest point in its favour. Input costs $0.30 per million tokens and output costs $0.90, giving a blended price of $0.45 per million tokens against a registry median of about $1.01. That places it 55th of 194 on price rank. Responses are capped at 8192 tokens, which may limit long generated outputs.\n\nThe model is offered by Mistral and OpenRouter. Its popularity rank is 178 of 194, and it is not built into the Pydantic AI Gateway, though that is not a drawback in itself.","described":true,"gateway":false,"byok":true,"string":"mistral:codestral-2508","input":0.3,"output":0.9,"cache_read":0.03,"blended":0.45,"efficiency":null,"bench":{},"offers":[{"provider":"mistral","name":"Mistral","model_id":"codestral-2508","api":["openai"],"input":0.3,"output":0.9,"cache_read":0.03,"cache_write":null,"input_tiers":[],"output_tiers":[],"context":256000,"deprecated":false,"gateway":false,"gateway_route":null,"byok":true,"string":"mistral:codestral-2508","gateway_string":null},{"provider":"openrouter","name":"OpenRouter","model_id":"mistralai/codestral-2508","api":["openai"],"input":0.3,"output":0.9,"cache_read":0.03,"cache_write":null,"input_tiers":[],"output_tiers":[],"context":256000,"deprecated":false,"gateway":false,"gateway_route":null,"byok":true,"string":"openrouter:mistralai/codestral-2508","gateway_string":null}],"ranks":{"intelligence":null,"popularity":178,"efficiency":null,"speed":19,"price":55},"top_score":0.0286,"about":["Closed-weight code model from Mistral, released July 2025, with a 256k context window and tool calling. It has no benchmark results in the registry, so its profile rests on specifications and price.","Codestral 2508 is a closed-weight model from Mistral, released July 30, 2025. It accepts text and file inputs and offers a 256k-token context window, which is large for a model in this price range. It supports tool calling and structured output but has no reasoning mode. The registry holds no benchmark results for it, so its quality cannot be ranked against other models here, and buyers will need to test it on their own tasks.","Pricing is the clearest point in its favour. Input costs $0.30 per million tokens and output costs $0.90, giving a blended price of $0.45 per million tokens against a registry median of about $1.01. That places it 55th of 194 on price rank. Responses are capped at 8192 tokens, which may limit long generated outputs.","The model is offered by Mistral and OpenRouter. Its popularity rank is 178 of 194, and it is not built into the Pydantic AI Gateway, though that is not a drawback in itself."],"examples":[{"file":"hello.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport os\n\nfrom pydantic_ai import Agent\n\nos.environ['MISTRAL_API_KEY'] = '...'\n\nagent = Agent('mistral:codestral-2508', instructions='Be concise, reply with one sentence.')\n\nresult = agent.run_sync('Where does \"hello world\" come from?')\nprint(result.output)","soon":false},{"file":"structured_output.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport os\n\nfrom pydantic import BaseModel\nfrom pydantic_ai import Agent\n\nos.environ['MISTRAL_API_KEY'] = '...'\n\n\nclass CityLocation(BaseModel):\n    city: str\n    country: str\n\n\nagent = Agent('mistral:codestral-2508', output_type=CityLocation)\n\nresult = agent.run_sync('Where were the olympics held in 2012?')\nprint(result.output)\n#> city='London' country='United Kingdom'","soon":false},{"file":"tools.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport os\nimport random\n\nfrom pydantic_ai import Agent, RunContext\n\nos.environ['MISTRAL_API_KEY'] = '...'\n\nagent = Agent(\n    'mistral:codestral-2508',\n    deps_type=str,\n    instructions=\"You're a dice game, roll the die and see if it matches the user's guess.\",\n)\n\n\n@agent.tool_plain\ndef roll_dice() -> str:\n    \"\"\"Roll a six-sided die and return the result.\"\"\"\n    return str(random.randint(1, 6))\n\n\n@agent.tool\ndef get_player_name(ctx: RunContext[str]) -> str:\n    \"\"\"Get the player's name.\"\"\"\n    return ctx.deps\n\n\nresult = agent.run_sync('My guess is 4', deps='Anne')\nprint(result.output)","soon":false},{"file":"streaming.py","lang":"python","code":"# /// script\n# dependencies = [\"pydantic-ai\"]\n# ///\nimport asyncio\nimport os\n\nfrom pydantic_ai import Agent\n\nos.environ['MISTRAL_API_KEY'] = '...'\n\nagent = Agent('mistral:codestral-2508')\n\n\nasync def main():\n    async with agent.run_stream('Explain prompt caching in three bullet points.') as response:\n        async for text in response.stream_text(delta=True):\n            print(text, end='', flush=True)\n\n\nasyncio.run(main())","soon":false},{"file":"pax.sh","lang":"sh","code":"export MISTRAL_API_KEY='...'\n\nuvx pax --model 'mistral:codestral-2508'","soon":true},{"file":"pi.sh","lang":"sh","code":"# npm install -g @earendil-works/pi-coding-agent\nexport MISTRAL_API_KEY='...'\n\npi --model 'mistral/codestral-2508'","soon":false},{"file":"codex.sh","lang":"sh","code":"# npm install -g @openai/codex\nexport MISTRAL_API_KEY='...'\n\ncodex --model 'codestral-2508' \\\n  -c model_provider='mistral' \\\n  -c model_providers.mistral.name='Mistral' \\\n  -c model_providers.mistral.base_url='https://api.mistral.example/v1' \\\n  -c model_providers.mistral.env_key='MISTRAL_API_KEY'","soon":false},{"file":"ai_sdk.ts","lang":"ts","code":"// npm install ai @ai-sdk/mistral\nimport { createMistral } from '@ai-sdk/mistral'\nimport { generateText } from 'ai'\n\nprocess.env.MISTRAL_API_KEY = '...'\n\nconst mistral = createMistral({ apiKey: process.env.MISTRAL_API_KEY })\n\nconst { text } = await generateText({\n  model: mistral('codestral-2508'),\n  system: 'Be concise, reply with one sentence.',\n  prompt: 'Where does \"hello world\" come from?',\n})\nconsole.log(text)","soon":false}],"benchmarks":[],"generated":"2026-11-25","gaps":{"speed":3,"index":80,"description":0}}