Back to APIs
Mistral AI
Mistral AI offers high-performance open-weight LLMs including Mistral 7B, Mixtral 8x7B, and Mistral Large — accessible via a clean OpenAI-compatible REST API.
Base URL
https://api.mistral.ai/v1LLMopen-weightchatembeddingsfast
Endpoints
POST
/chat/completionsGenerate a chat completion using Mistral models.
const response = await fetch("https://api.mistral.ai/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
},
body: JSON.stringify({
"model": "mistral-large-latest",
"messages": [
{
"role": "user",
"content": "Explain transformers."
}
]
})
});
const data = await response.json();
console.log(data);Response Preview
{
"id": "cmpl-abc123",
"object": "chat.completion",
"model": "mistral-large-latest",
"choices": [{
"message": { "role": "assistant", "content": "Transformers are neural network architectures..." },
"finish_reason": "stop"
}],
"usage": { "prompt_tokens": 8, "completion_tokens": 42 }
}