Free, Unlimited Mistral API
On this page
This tutorial will show you how to use Puter.js to access Mistral's powerful AI models for free, without any API keys. Using Puter.js, you can leverage models like Mistral Large 3, Mistral Medium 3.1, Mistral Small 3.2, Codestral, Devstral, Magistral, Ministral 3, Mixtral, Pixtral, and Voxtral for various tasks including text generation, code completion, and complex reasoning without worrying about usage limits or costs.
Puter.js uses the User-Pays model, where users of your application cover their own AI costs. This means you as a developer don't pay anything for your users' usage, making your app practically free to run. You can scale to unlimited users and pay nothing for the AI usage.
Getting Started
Puter.js works without any API keys or sign-ups. To start using Puter.js, include the following script tag in your HTML file, either in the <head> or <body> section:
<script src="https://js.puter.com/v2/"></script>
You're now ready to use Puter.js for free access to Mistral capabilities. No API keys or sign-ups are required.
Example 1: Basic Text Generation with Mistral Large 3
To generate text using Mistral Large 3, use the puter.ai.chat() function with your preferred model:
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
puter.ai.chat("Explain the concept of machine learning to a beginner", {
model: 'mistralai/mistral-large-2512'
}).then(response => {
puter.print(response.message.content);
});
</script>
</body>
</html>
Example 3: Code Generation with Codestral
Codestral is Mistral's specialized model for code generation. Here's how to use it:
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
puter.ai.chat(
"Write a Python function that calculates the Fibonacci sequence up to n terms",
{model: 'mistralai/codestral-2508'}
).then(response => {
puter.print(response.message.content, {code: true});
});
</script>
</body>
</html>
Example 4: Agentic Coding with Devstral 2
Devstral is Mistral's state-of-the-art open model specialized in agentic coding.
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
puter.ai.chat(
"Create a simple to-do list app in a single HTML file with add, delete, and mark complete features",
{model: 'mistralai/devstral-2512'}
).then(response => {
puter.print(response.message.content, {code: true});
});
</script>
</body>
</html>
Example 3: Streaming Responses for Longer Content
For longer responses, use streaming to get results in real-time:
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
(async () => {
const response = await puter.ai.chat(
"Write a comprehensive guide on sustainable living practices",
{
model: 'mistralai/mistral-large-2512',
stream: true
}
);
for await (const part of response) {
if (part?.text) {
puter.print(part.text);
}
}
})();
</script>
</body>
</html>
Example 4: Creative Writing and Narrative Generation
Mistral Small Creative is optimized for storytelling and imaginative content:
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
(async () => {
const response = await puter.ai.chat(
"Write a short story about a robot who discovers music for the first time",
{
model: 'mistralai/mistral-small-creative',
stream: true
}
);
for await (const part of response) {
if (part?.text) {
puter.print(part.text);
}
}
})();
</script>
</body>
</html>
Example 5: Using Different Mistral Models
Mistral offers various models optimized for different use cases. Here's how to use them:
<html>
<body>
<script src="https://js.puter.com/v2/"></script>
<script>
// Mistral Large 3 - Best for complex tasks
puter.ai.chat(
"Analyze the economic implications of renewable energy adoption",
{ model: "mistralai/mistral-large-2512" }
).then(response => {
puter.print("<h2>Mistral Large 3 Response:</h2>");
puter.print(response.message.content);
});
// Mistral Medium 3.1 - Balanced performance
puter.ai.chat(
"Summarize the key points of climate change",
{ model: "mistralai/mistral-medium-3.1" }
).then(response => {
puter.print("<h2>Mistral Medium 3.1 Response:</h2>");
puter.print(response.message.content);
});
// Mistral Small 3.2 - Fast and efficient
puter.ai.chat(
"What are the benefits of regular exercise?",
{ model: "mistralai/mistral-small-3.2-24b-instruct" }
).then(response => {
puter.print("<h2>Mistral Small 3.2 Response:</h2>");
puter.print(response.message.content);
});
// Mistral Nemo - Lightweight model
puter.ai.chat(
"Explain photosynthesis in simple terms",
{ model: "mistralai/mistral-nemo" }
).then(response => {
puter.print("<h2>Mistral Nemo Response:</h2>");
puter.print(response.message.content);
});
</script>
</body>
</html>
Available Mistral Models
Puter.js provides access to the following Mistral models:
mistralai/codestral-2508
mistralai/devstral-2512
mistralai/devstral-2512:free
mistralai/devstral-medium
mistralai/devstral-small
mistralai/devstral-small-2505
mistralai/ministral-14b-2512
mistralai/ministral-3b
mistralai/ministral-3b-2512
mistralai/ministral-8b
mistralai/ministral-8b-2512
mistralai/mistral-7b-instruct
mistralai/mistral-7b-instruct-v0.1
mistralai/mistral-7b-instruct-v0.2
mistralai/mistral-7b-instruct-v0.3
mistralai/mistral-7b-instruct:free
mistralai/mistral-large
mistralai/mistral-large-2407
mistralai/mistral-large-2411
mistralai/mistral-large-2512
mistralai/mistral-medium-3
mistralai/mistral-medium-3.1
mistralai/mistral-nemo
mistralai/mistral-saba
mistralai/mistral-small-24b-instruct-2501
mistralai/mistral-small-3.1-24b-instruct
mistralai/mistral-small-3.1-24b-instruct:free
mistralai/mistral-small-3.2-24b-instruct
mistralai/mistral-small-creative
mistralai/mistral-tiny
mistralai/mixtral-8x22b-instruct
mistralai/mixtral-8x7b-instruct
mistralai/pixtral-12b
mistralai/pixtral-large-2411
mistralai/voxtral-small-24b-2507
That's it! You now have free, unlimited access to Mistral's powerful AI models using Puter.js. This allows you to leverage advanced language understanding, generation, and coding capabilities without worrying about API keys or usage limits.
Related
Free, Serverless AI and Cloud
Start creating powerful web applications with Puter.js in seconds!
Get Started Now