Environment:Mistralai Client python GCP Deployment Environment
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Cloud_Deployment |
| Last Updated | 2026-02-15 14:00 GMT |
Overview
Python 3.10+ environment with `google-auth` and the `mistralai_gcp` package for Mistral models on GCP Vertex AI.
Description
This environment provides the context for running Mistral models through Google Cloud Vertex AI. It uses the `mistralai_gcp` package which handles OAuth2 authentication via Google Application Default Credentials (ADC) and transparently rewrites API URLs to the Vertex AI `rawPredict`/`streamRawPredict` endpoints. The SDK constructs URLs in the format `https://{region}-aiplatform.googleapis.com/v1/projects/{project_id}/locations/{region}/publishers/mistralai/models/{model}:rawPredict`.
Usage
Use this environment when deploying and consuming Mistral models through Google Cloud Vertex AI. It supports chat completions, streaming, and Fill-in-the-Middle (FIM) code completion.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, Windows | Same as core SDK |
| Python | >= 3.10 | Consistent with main SDK requirement |
| Cloud | GCP project with Vertex AI enabled | Must enable Mistral models in Vertex AI Model Garden |
Dependencies
System Packages
- `gcloud` CLI (recommended for authentication setup)
Python Packages
- `mistralai_gcp` >= 1.8.0 (or `pip install "mistralai[gcp]"`)
- `google-auth` >= 2.31.0, < 3.0.0
- `requests` >= 2.32.3, < 3.0.0
- `httpx` >= 0.28.1
- `pydantic` >= 2.10.3
- `eval-type-backport` >= 0.2.0
- `python-dateutil` >= 2.8.2
- `typing-inspection` >= 0.4.0
Credentials
The following must be configured:
- Google Application Default Credentials (ADC): Set up via `gcloud auth application-default login`.
- `GCP_PROJECT_ID`: GCP project ID (can be auto-detected from ADC or passed explicitly).
Or alternatively:
- `access_token`: Manual OAuth2 bearer token (bypasses ADC).
Quick Install
# Install via main SDK extra
pip install "mistralai[gcp]"
# Or install standalone GCP package
pip install mistralai_gcp
# Authenticate with GCP
gcloud auth application-default login
Code Evidence
GCP client initialization from `packages/mistralai_gcp/src/mistralai_gcp/sdk.py`:
MistralGoogleCloud(
region="europe-west4", # GCP region
project_id=os.environ.get("GCP_PROJECT_ID"), # Auto-detected from ADC if not set
access_token=None, # Optional manual OAuth2 token
)
GCP dependency in `pyproject.toml:22-26`:
[project.optional-dependencies]
gcp = [
"google-auth >=2.27.0",
"requests >=2.32.3",
]
URL rewriting is handled by `GoogleCloudBeforeRequestHook` which constructs Vertex AI rawPredict URLs automatically.
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `google.auth.exceptions.DefaultCredentialsError` | ADC not configured | Run `gcloud auth application-default login` |
| `MistralGCPError` (HTTP 403) | Insufficient permissions or Vertex AI not enabled | Enable Vertex AI API in GCP console and check IAM permissions |
| `MistralGCPError` (HTTP 404) | Model not available in region | Verify model is available in the specified GCP region |
Compatibility Notes
- Default region: `europe-west4`. Override with `region` parameter.
- Model names: Standard Mistral model names are used; the SDK rewrites URLs to Vertex AI format automatically.
- Features: GCP package supports `chat.complete`, `chat.stream`, `fim.complete`, and `fim.stream`. Fine-tuning and file management are not available through GCP.
- Authentication: ADC is preferred; manual `access_token` available as fallback.