Mistral's API lives at https://api.mistral.ai/v1 and follows the familiar chat-completions shape. -latest model names always point at the newest version of that model.
Create a key in console.mistral.ai and send it as Authorization: Bearer <key>. In the examples it's written {{MISTRAL_API_KEY}}.
Full reference: https://docs.mistral.ai/api/
The reply is in choices[0].message.content.
curl https://api.mistral.ai/v1/chat/completions \
-H "Authorization: Bearer {{MISTRAL_API_KEY}}" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-large-latest",
"messages": [{"role": "user", "content": "What is the difference between PUT and PATCH?"}]
}'
response_format forces valid JSON. Say what shape you want in the prompt.
curl https://api.mistral.ai/v1/chat/completions \
-H "Authorization: Bearer {{MISTRAL_API_KEY}}" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-small-latest",
"response_format": {"type": "json_object"},
"messages": [{"role": "user", "content": "List three HTTP methods as JSON: {\"methods\": [...]}"}]
}'
One vector per input string, in data[].embedding.
curl https://api.mistral.ai/v1/embeddings \
-H "Authorization: Bearer {{MISTRAL_API_KEY}}" \
-H "Content-Type: application/json" \
-d '{"model": "mistral-embed", "input": ["The quick brown fox", "A lazy dog"]}'
Every model your key can use, including the exact versions behind each -latest alias.
curl https://api.mistral.ai/v1/models \
-H "Authorization: Bearer {{MISTRAL_API_KEY}}"