Appearance
Mistral Integration
Mistral provides open-source and commercial AI models with European data compliance. GateFlow integrates seamlessly with Mistral's complete model portfolio for optimized routing and sustainability.
Available Models
Chat Completion Models
| Model | Context Window | Max Output | Input Cost | Output Cost |
|---|---|---|---|---|
mistral-large-3 | 128k | 8,192 | $2.00/1M | $6.00/1M |
mistral-large-latest | 128k | 8,192 | $2.00/1M | $6.00/1M |
mistral-small-3 | 128k | 8,192 | $0.20/1M | $0.60/1M |
mistral-small-latest | 128k | 8,192 | $0.20/1M | $0.60/1M |
ministral-3b | 128k | 8,192 | $0.04/1M | $0.04/1M |
ministral-8b | 128k | 8,192 | $0.10/1M | $0.10/1M |
ministral-14b | 128k | 8,192 | $0.15/1M | $0.15/1M |
pixtral-large-latest | 128k | 8,192 | $2.00/1M | $6.00/1M |
devstral-2 | 128k | 16,384 | $0.50/1M | $1.50/1M |
devstral-small-2 | 128k | 16,384 | $0.10/1M | $0.30/1M |
Embedding Models
| Model | Dimensions | Max Tokens | Cost |
|---|---|---|---|
mistral-embed | 1,024 | 8,192 | $0.10/1M |
Speech-to-Text Models
| Model | Languages | Cost |
|---|---|---|
voxtral-mini-latest | 100+ | $0.02/min |
voxtral-mini-2602 | 100+ | $0.02/min |
OCR Models
| Model | Cost |
|---|---|
mistral-ocr-latest | $0.01/page |
Configuration
Provider Setup
bash
curl -X POST https://api.gateflow.ai/v1/management/providers \
-H "Authorization: Bearer gw_admin_..." \
-H "Content-Type: application/json" \
-d '{
"provider": "mistral",
"credentials": {
"api_key": "..."
}
}'Model Configuration
json
{
"provider": "mistral",
"credentials": {
"api_key": "..."
}
}Sustainability Features
Mistral integration through GateFlow offers several sustainability benefits:
- European Data Centers: GDPR-compliant data processing with renewable energy
- Open-Source Options: Reduced licensing costs and environmental impact
- Edge Deployment: Run models locally to minimize data transfer carbon footprint
- Carbon-Optimized Routing: Automatically select the most energy-efficient EU data center
- Time-Shifted Execution: Defer non-urgent requests to low-carbon periods
Example Usage
Basic Chat Completion
python
from openai import OpenAI
client = OpenAI(
base_url="https://api.gateflow.ai/v1",
api_key="gw_prod_your_key_here"
)
# Use Mistral for EU-compliant processing
response = client.chat.completions.create(
model="mistral-large-3",
messages=[{"role": "user", "content": "Process this GDPR-sensitive data"}],
routing_mode="sustain_optimized",
region="eu-west-1"
)
print(f"Response: {response.choices[0].message.content}")
print(f"Model used: {response.model}")
print(f"Carbon footprint: {response.sustainability.carbon_gco2e} gCO₂e")
print(f"Carbon saved: {response.sustainability.carbon_saved_gco2e} gCO₂e")Coding Specialist
python
# Use Devstral for code generation
response = client.chat.completions.create(
model="devstral-2",
messages=[{"role": "user", "content": "Generate Python code for this algorithm"}],
routing_mode="sustain_optimized"
)
print(f"Generated code:\n{response.choices[0].message.content}")Using Embeddings
python
# Generate embeddings with Mistral
embedding_response = client.embeddings.create(
model="mistral-embed",
input=[
"Document 1 content",
"Document 2 content",
"User query"
],
routing_mode="sustain_optimized"
)
for i, embedding in enumerate(embedding_response.data):
print(f"Embedding {i+1}: {len(embedding.embedding)} dimensions")
print(f"Carbon footprint: {embedding.sustainability.carbon_gco2e} gCO₂e")Speech-to-Text
python
# Use Voxtral for speech recognition
with open("audio.mp3", "rb") as audio_file:
transcription = client.audio.transcriptions.create(
model="voxtral-mini-latest",
file=audio_file,
routing_mode="sustain_optimized"
)
print(f"Transcription: {transcription.text}")
print(f"Carbon saved: {transcription.sustainability.carbon_saved_gco2e} gCO₂e")Mistral-Specific Features
Edge Deployment
python
# Configure for edge deployment
response = client.chat.completions.create(
model="ministral-3b",
messages=[{"role": "user", "content": "Process this locally"}],
routing_mode="sustain_optimized",
deployment_mode="edge"
)Multi-modal Support
python
# Use Pixtral for vision tasks
response = client.chat.completions.create(
model="pixtral-large-latest",
messages=[
{
"role": "user",
"content": [
{"type": "text", "text": "Analyze this image"},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/image.jpg"
}
}
]
}
],
routing_mode="sustain_optimized"
)Function Calling
python
# Define functions for tool use
tools = [
{
"type": "function",
"function": {
"name": "search_database",
"description": "Search company database",
"parameters": {
"type": "object",
"properties": {
"query": {"type": "string"}
}
}
}
}
]
response = client.chat.completions.create(
model="mistral-large-3",
messages=[{"role": "user", "content": "Find sustainability data"}],
tools=tools,
routing_mode="sustain_optimized"
)Model Selection Guide
| Use Case | Recommended Model | Key Features | Sustainability Benefits |
|---|---|---|---|
| Production use | mistral-large-3 | 675B parameters | EU-based renewable energy |
| Cost-effective | mistral-small-3 | Balanced performance | Lowest carbon footprint |
| Coding tasks | devstral-2 | 123B coding specialist | Optimized for development |
| Vision tasks | pixtral-large-latest | Multimodal | EU-based processing |
| Edge deployment | ministral-3b | 3B ultra-fast | Minimal energy consumption |
| Fast edge | ministral-8b | 8B balanced | Low-power optimization |
| Premium edge | ministral-14b | 14B high-quality | Energy-efficient architecture |
| EU embeddings | mistral-embed | 1,024 dimensions | GDPR-compliant processing |
| Speech-to-text | voxtral-mini-latest | 100+ languages | Low-carbon audio processing |
Sustainability Best Practices
Optimization Strategies
- Leverage EU data centers: Process data in European regions for GDPR compliance and renewable energy
- Use edge models: Deploy Ministral models locally to minimize data transfer carbon footprint
- Right-size your model: Use
mistral-small-3for simple tasks instead of Large models - Enable Sustain Mode: Let GateFlow automatically choose the most efficient Mistral model
- Use time-shifting: Defer non-urgent requests to low-carbon periods in Europe
- Batch requests: Process multiple items in single API calls to reduce overhead
Configuration Example
python
# Configure Mistral provider with sustainability settings
response = client.chat.completions.create(
model="mistral:auto", # Let GateFlow choose most efficient Mistral model
messages=[{"role": "user", "content": "Process this sustainably in EU"}],
routing_mode="sustain_optimized",
minimum_quality_score=8, # Balance quality and efficiency
region_preference="eu-west-1", # Prioritize EU renewable energy regions
deployment_mode="edge" # Use edge deployment when possible
)Performance Characteristics
Latency Comparison
- Fastest:
ministral-3b(200ms) - Balanced:
ministral-8b(350ms),mistral-small-3(500ms) - Standard:
mistral-large-3(1,400ms) - Specialized:
devstral-2(1,200ms),pixtral-large-latest(900ms)
Token Limits
- All chat models: 128K context window
- Output limits: 8,192-16,384 tokens depending on model
- Embedding models: 8K token input limit
Pricing Overview
- Input prices: $0.04-$2.00 per 1M tokens
- Output prices: $0.04-$6.00 per 1M tokens
- Embeddings: $0.10 per 1M tokens
- Speech-to-text: $0.02 per minute
- OCR: $0.01 per page
Integration with Other GateFlow Features
Multi-Provider Fallbacks
python
# Configure Mistral as primary with fallbacks
response = client.chat.completions.create(
model="mistral-large-3", # Primary: Mistral
messages=[{"role": "user", "content": "Important EU-compliant request"}],
fallback_providers=["openai", "anthropic"], # Fallback chain
routing_mode="sustain_optimized",
region_preference="eu-west-1" # Keep in EU for compliance
)Semantic Caching
python
# Cache frequent Mistral requests
response = client.chat.completions.create(
model="mistral-small-3",
messages=[{"role": "user", "content": "Frequently asked GDPR question"}],
cache_ttl_seconds=3600, # Cache for 1 hour
embedding_model="mistral-embed" # Use Mistral embeddings for semantic matching
)Troubleshooting
"Mistral API key not configured"
Solution: Add your Mistral API key in the GateFlow Dashboard under Settings → Providers.
"Model not found: mistral-7b"
Solution: Use current models like mistral-small-3 instead of deprecated models.
"Rate limit exceeded"
Solution:
- Check your Mistral account limits
- Configure fallbacks to other providers
- Enable request queuing in GateFlow settings
- Use
ministral-3bfor high-volume applications
"Carbon savings lower than expected"
Solution:
- Verify Sustain Mode is properly configured
- Check EU grid carbon intensity
- Try different Mistral models for better efficiency
- Enable edge deployment for eligible workloads
Migration from Direct Mistral API
Key Differences
| Feature | Direct Mistral API | GateFlow Mistral Integration |
|---|---|---|
| API Format | Mistral-specific | OpenAI-compatible |
| Authentication | Mistral API key | GateFlow API key |
| Model Names | mistral-7b | mistral-small-3 |
| Carbon Tracking | Manual | Automatic |
| Multi-provider | No | Yes |
| Fallbacks | Manual | Automatic |
| Sustainability | Basic | Advanced optimization |
| Edge Deployment | Limited | Full support |
Migration Example
Before (Direct Mistral API):
python
from mistralai.client import MistralClient
client = MistralClient(api_key="your-mistral-api-key")
response = client.chat(
model="mistral-7b",
messages=[{"role": "user", "content": "Hello from Mistral!"}]
)After (GateFlow Integration):
python
from openai import OpenAI
client = OpenAI(
base_url="https://api.gateflow.ai/v1",
api_key="gw_prod_your_gateflow_key"
)
response = client.chat.completions.create(
model="mistral-small-3", # Use current models
messages=[{"role": "user", "content": "Hello from Mistral via GateFlow with EU compliance!"}],
routing_mode="sustain_optimized", # Enable carbon optimization
region="eu-west-1" # Process in EU for compliance
)Next Steps
- Explore OpenAI Integration - Versatile AI models
- Try Anthropic Integration - Advanced reasoning models
- Configure Sustain Mode - Automatic carbon optimization
- View Provider Analytics - Monitor your Mistral carbon savings
- EU Compliance Guide - Learn about GDPR-compliant AI processing