Principle:Mistralai Client python GCP Client Initialization
| Knowledge Sources | |
|---|---|
| Domains | Cloud_Deployment, GCP, API_Client |
| Last Updated | 2026-02-15 14:00 GMT |
Overview
A cloud-specific client initialization pattern that configures an API client for Mistral models on GCP Vertex AI with Google Application Default Credentials and automatic URL rewriting.
Description
GCP Client Initialization creates a MistralGoogleCloud client configured for Mistral models available through the Vertex AI Model Garden. The client uses Google Application Default Credentials (ADC) for authentication (or an explicit access token), and employs a GoogleCloudBeforeRequestHook that rewrites all API URLs to the Vertex AI rawPredict / streamRawPredict endpoint format. The URL rewriting transparently converts standard Mistral API paths to GCP Vertex AI paths.
Usage
Use this principle when accessing Mistral models through GCP Vertex AI. Requires a GCP project with Vertex AI enabled and Mistral models available in the Model Garden. Authentication uses gcloud auth application-default login or an explicit access token.
Theoretical Basis
GCP deployment adds authentication and URL rewriting layers:
- Application Default Credentials (ADC): Automatic credential discovery from environment
- URL rewriting: Transforms API paths to Vertex AI format
- Region-based routing: Each request targets a specific GCP region's Vertex AI endpoint
- The final URL format: https://{region}-aiplatform.googleapis.com/v1/projects/{project}/locations/{region}/publishers/mistralai/models/{model}:rawPredict