# Mistral AI Integration via LowCodeAPI
## Overview
Mistral AI provides open-source language models with chat completions, embeddings, fine-tuning, and advanced features like agents, file handling, and OCR.
## Base Endpoint
```
https://api.lowcodeapi.com/mistralai/
```
## Authentication
LowCodeAPI handles authentication automatically. You only need to:
1. **Sign up** at https://console.mistral.ai/
2. **Connect your account** in LowCodeAPI dashboard
3. **Use your `api_token`** in all requests
The `api_token` is your LowCodeAPI authentication token. LowCodeAPI will automatically:
- Fetch your Mistral AI API key from database
- Apply it to each request with proper Bearer token header
**Auth Type**: `API Key` (Bearer Token)
## API Categories
- Frontier AI labs
- Chat
- FIM (Fill-in-Middle)
- Embeddings
- Files
- Fine Tuning
- Batch
- Agents
- Models
- Moderation
- Classification
- OCR
- Audio
- Conversations
- Libraries
## Common Endpoints
### Category: Chat
#### Create Chat Completions
**Method**: `POST` | **LowCodeAPI Path**: `/v1/chat/completions`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/chat/completions?api_token={api_token}
```
**Description**: Generate chat completions using Mistral AI models.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `model` | string | Yes | ID of the model to use |
| `messages` | array | Yes | Array of message objects with role and content |
| `temperature` | number | No | Sampling temperature (default: 0.7) |
| `top_p` | number | No | Nucleus sampling parameter (default: 1) |
| `max_tokens` | number | No | Maximum tokens to generate |
| `stream` | boolean | No | Enable streaming response (default: false) |
| `safe_prompt` | boolean | No | Force safe prompt (default: false) |
| `random_seed` | number | No | Seed for deterministic results |
**Example Request**:
```bash
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/chat/completions?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-small-latest",
"messages": [
{
"role": "user",
"content": "Write a haiku about artificial intelligence"
}
],
"temperature": 0.7,
"max_tokens": 100
}'
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/createChatCompletion
---
### Category: FIM
#### Create FIM Completions
**Method**: `POST` | **LowCodeAPI Path**: `/v1/fim/completions`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/fim/completions?api_token={api_token}
```
**Description**: Generate code completions using Fill-in-Middle (FIM) models.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `model` | string | Yes | Model ID for code completion |
| `prompt` | string | Yes | The text/code to complete |
| `suffix` | string | No | Optional text/code for more context |
| `max_tokens` | number | No | Maximum tokens to generate |
| `temperature` | number | No | Sampling temperature (default: 0.7) |
| `top_p` | number | No | Nucleus sampling parameter |
| `min_tokens` | number | No | Minimum tokens to generate |
| `random_seed` | number | No | Seed for deterministic results |
| `stop` | array | No | Sequences that stop generation |
| `stream` | boolean | No | Enable streaming response |
**Example Request**:
```bash
# Complete code with context
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/fim/completions?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "codestral-latest",
"prompt": "def fibonacci(n):",
"suffix": " return result",
"max_tokens": 200
}'
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/createFIMCompletion
---
### Category: Embeddings
#### Create Embeddings
**Method**: `POST` | **LowCodeAPI Path**: `/v1/embeddings`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/embeddings?api_token={api_token}
```
**Description**: Generate embeddings for text inputs.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `model` | string | Yes | Model ID for embeddings |
| `input` | array | Yes | List of strings to embed |
| `encoding_format` | string | Yes | Output format (float or base64) |
**Example Request**:
```bash
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/embeddings?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-embed",
"input": ["Hello world", "Embed this text"],
"encoding_format": "float"
}'
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/createEmbedding
---
### Category: Files
#### List Files
**Method**: `GET` | **LowCodeAPI Path**: `/v1/files`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/files?api_token={api_token}
```
**Description**: Returns a list of files that belong to the user's organization.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/mistralai/v1/files?api_token=YOUR_API_TOKEN"
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/files_api_routes_list_files
---
#### Upload File
**Method**: `POST` | **LowCodeAPI Path**: `/v1/files`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/files?api_token={api_token}
```
**Description**: Upload a file that can be used across various endpoints.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `file` | file | Yes | The file object to be uploaded |
| `purpose` | string | Yes | The intended purpose of the uploaded file |
**Example Request**:
```bash
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/files?api_token=YOUR_API_TOKEN" \
-F "file=@training_data.jsonl" \
-F "purpose=fine-tuning"
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/files_api_routes_upload_file
---
#### Retrieve File
**Method**: `GET` | **LowCodeAPI Path**: `/v1/files/file_id`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/files/file_id?file_id={file_id}&api_token={api_token}
```
**Description**: Returns information about a specific file.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `file_id` | string | Yes | The ID of the file to retrieve |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/mistralai/v1/files/file_id?file_id=FILE_ID&api_token=YOUR_API_TOKEN"
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/files_api_routes_retrieve_file
---
#### Delete File
**Method**: `DELETE` | **LowCodeAPI Path**: `/v1/files/file_id`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/files/file_id?file_id={file_id}&api_token={api_token}
```
**Description**: Delete a file.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `file_id` | string | Yes | The ID of the file to delete |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Example Request**:
```bash
curl -X DELETE "https://api.lowcodeapi.com/mistralai/v1/files/file_id?file_id=FILE_ID&api_token=YOUR_API_TOKEN"
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/files_api_routes_delete_file
---
### Category: Fine Tuning
#### List Fine Tuning Jobs
**Method**: `GET` | **LowCodeAPI Path**: `/v1/fine_tuning/jobs`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/fine_tuning/jobs?api_token={api_token}
```
**Description**: Get a list of fine tuning jobs for your organization and user.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
| `page` | number | No | Page number (default: 0) |
| `page_size` | number | No | Items per page (default: 100) |
| `status` | string | No | Filter by job status |
| `model` | string | No | Filter by model name |
| `suffix` | string | No | Filter by model suffix |
| `created_by_me` | boolean | No | Only show jobs created by API caller |
| `created_after` | string | No | Filter by creation date |
| `wandb_project` | string | No | Filter by Weights and Biases project |
| `wandb_name` | string | No | Filter by Weights and Biases run name |
**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/mistralai/v1/fine_tuning/jobs?page=0&page_size=50&api_token=YOUR_API_TOKEN"
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/jobs_api_routes_fine_tuning_get_fine_tuning_jobs
---
#### Create Fine Tuning Job
**Method**: `POST` | **LowCodeAPI Path**: `/v1/fine_tuning/jobs`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/fine_tuning/jobs?api_token={api_token}&dry_run={dry_run}
**Description**: Create a new fine tuning job, it will be queued for processing.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
| `dry_run` | boolean | Yes | Validate without training (default: false) |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `model` | string | Yes | Model to fine-tune (open-mistral-7b, mistral-small-latest) |
| `training_files` | array | Yes | List of uploaded file IDs with training data |
| `validation_files` | array | No | List of file IDs with validation data |
| `hyperparameters` | object | No | Fine-tuning hyperparameter settings |
| `integrations` | array | No | List of integrations to enable |
| `suffix` | string | No | String added to fine-tuned model name |
**Example Request**:
```bash
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/fine_tuning/jobs?api_token=YOUR_API_TOKEN&dry_run=false" \
-H "Content-Type: application/json" \
-d '{
"model": "open-mistral-7b",
"training_files": ["FILE_ID_1", "FILE_ID_2"],
"suffix": "my-custom-model",
"hyperparameters": {
"learning_rate": 0.0001,
"epochs": 3
}
}'
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/jobs_api_routes_fine_tuning_create_fine_tuning_job
---
#### Get Fine Tuning Job
**Method**: `GET` | **LowCodeAPI Path**: `/v1/fine_tuning/jobs/job_id`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/fine_tuning/jobs/job_id?job_id={job_id}&api_token={api_token}
```
**Description**: Get a fine tuned job details by its UUID.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `job_id` | string | Yes | The ID of the job to analyze |
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/mistralai/v1/fine_tuning/jobs/job_id?job_id=JOB_ID&api_token=YOUR_API_TOKEN"
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/jobs_api_routes_fine_tuning_get_fine_tuning_job
---
### Category: Models
#### List Available Models
**Method**: `GET` | **LowCodeAPI Path**: `/v1/models`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/models?api_token={api_token}
```
**Description**: List all available models in your account.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Example Request**:
```bash
curl -X GET "https://api.lowcodeapi.com/mistralai/v1/models?api_token=YOUR_API_TOKEN"
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/listModels
---
### Category: Agents
#### Create Agent
**Method**: `POST` | **LowCodeAPI Path**: `/v1/agents`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/agents?api_token={api_token}
```
**Description**: Create an agent that can be used within a conversation.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | Yes | The name of the agent |
| `instructions` | string | Yes | The instructions for the agent |
| `model` | string | No | The model to use for the agent |
| `tools` | array | No | The tools available to the agent |
| `description` | string | No | The description of the agent |
**Example Request**:
```bash
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/agents?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Customer Support Agent",
"instructions": "You are a helpful customer service representative. Answer questions politely and professionally.",
"model": "mistral-small-latest",
"description": "Handles customer inquiries"
}'
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/agents_api_v1_agents_create
---
#### Create Agent Completion
**Method**: `POST` | **LowCodeAPI Path**: `/v1/agents/completions`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/agents/completions?api_token={api_token}
```
**Description**: Create a completion using an agent.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `agent_id` | string | Yes | The ID of the agent to use |
| `messages` | array | Yes | The messages for the completion |
| `stream` | boolean | No | Whether to stream the response |
**Example Request**:
```bash
# Use agent_id from Create Agent response
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/agents/completions?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "AGENT_ID",
"messages": [
{"role": "user", "content": "What is your return policy?"}
],
"stream": false
}'
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/agents_api_v1_agents_completions
---
### Category: Audio
#### Create Transcription
**Method**: `POST` | **LowCodeAPI Path**: `/v1/audio/transcriptions`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/audio/transcriptions?api_token={api_token}
```
**Description**: Create a transcription from an audio file.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `file` | file | Yes | The audio file to transcribe |
| `model` | string | No | The model to use for transcription |
**Example Request**:
```bash
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/audio/transcriptions?api_token=YOUR_API_TOKEN" \
-F "[email protected]" \
-F "model=pixtral-12b"
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/audio_api_v1_transcriptions_post
---
### Category: OCR
#### OCR
**Method**: `POST` | **LowCodeAPI Path**: `/v1/ocr`
**Full URL**:
```
https://api.lowcodeapi.com/mistralai/v1/ocr?api_token={api_token}
```
**Description**: Perform OCR (Optical Character Recognition) on an image.
**Query Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `api_token` | string | Yes | Your LowCodeAPI authentication token |
**Request Body Parameters**:
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `image_url` | string | Yes | The URL of the image to perform OCR on |
**Example Request**:
```bash
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/ocr?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/document.jpg"
}'
```
**Official Documentation**: https://docs.mistral.ai/api/#operation/ocr_v1_ocr_post
---
## Usage Examples
### Example 1: Chat with Streaming
Generate responses with real-time streaming.
```bash
# Enable streaming for real-time output
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/chat/completions?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "mistral-small-latest",
"messages": [
{"role": "system", "content": "You are a creative writing assistant."},
{"role": "user", "content": "Write a short story about a robot learning to paint."}
],
"stream": true,
"max_tokens": 500,
"temperature": 0.8
}'
```
### Example 2: Fine-tune a Custom Model
Complete workflow for fine-tuning.
```bash
# Step 1: Upload training file
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/files?api_token=YOUR_API_TOKEN" \
-F "file=@training_data.jsonl" \
-F "purpose=fine-tuning"
# Step 2: Create fine-tuning job
# Use the file ID from upload response
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/fine_tuning/jobs?api_token=YOUR_API_TOKEN&dry_run=false" \
-H "Content-Type: application/json" \
-d '{
"model": "open-mistral-7b",
"training_files": ["FILE_ID"],
"suffix": "custom-trained"
}'
# Step 3: Check job status
# Use job_id from creation response
curl -X GET "https://api.lowcodeapi.com/mistralai/v1/fine_tuning/jobs/job_id?job_id=JOB_ID&api_token=YOUR_API_TOKEN"
# Step 4: Use the fine-tuned model
# Once status is SUCCESS, use the returned model ID
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/chat/completions?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "MODEL_ID_FROM_JOB",
"messages": [{"role": "user", "content": "Test my custom model"}]
}'
```
### Example 3: Use Agents for Specialized Tasks
Create and use agents for specific purposes.
```bash
# Step 1: Create an agent
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/agents?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Data Analyst",
"instructions": "You analyze data and provide insights. Be thorough but concise.",
"model": "mistral-small-latest"
}'
# Step 2: Use the agent for completions
# Use the agent_id from creation response
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/agents/completions?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "AGENT_ID",
"messages": [
{"role": "user", "content": "Analyze these sales figures and provide recommendations"}
]
}'
```
### Example 4: OCR and Audio Processing
Extract text from images and transcribe audio.
```bash
# Extract text from image
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/ocr?api_token=YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"image_url": "https://example.com/scanned-document.jpg"
}'
# Transcribe audio file
curl -X POST "https://api.lowcodeapi.com/mistralai/v1/audio/transcriptions?api_token=YOUR_API_TOKEN" \
-F "[email protected]" \
-F "model=pixtral-12b"
```
## Complete Endpoint Reference
For a complete list of all endpoints and their parameters, refer to:
- **OpenAPI Definition**: `https://backend.lowcodeapi.com/mistralai/definition`
- **Official Provider Documentation**: https://docs.mistral.ai/
## Rate Limits & Best Practices
- Fine-tuning jobs take time to complete - poll status endpoint
- Use streaming for long completions to improve perceived performance
- Agents provide reusable instructions for consistent behavior
- Upload training files before creating fine-tuning jobs
## Error Handling
Standard HTTP status codes apply. Check fine-tuning job status for detailed error information about training failures.