> ## Documentation Index
> Fetch the complete documentation index at: https://docs.promptguard.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Mistral AI

> Scan Mistral AI traffic through the PromptGuard proxy with any OpenAI client

## Proxy

<Note>
  **Proxy Base URL:** `https://api.promptguard.co/api/v1`

  Point your LLM SDK's `base_url` / `baseURL` to this endpoint. Your existing provider API key goes in the `Authorization` header as usual; add your PromptGuard key via `X-API-Key`.
</Note>

Model ids starting `mistral-`, `ministral-3`, `ministral-8b`, `ministral-14b`, `magistral-`, `codestral`, `devstral`, `voxtral`, `pixtral-` or `ocr-` go to Mistral. Hugging Face's `mistralai/` hub ids are not Mistral's API: they go to [Hugging Face](/integrations/providers/huggingface).

Mistral speaks OpenAI's wire format, so PromptGuard forwards your request to `api.mistral.ai/v1` as you sent it and returns Mistral's reply unchanged. Any OpenAI client works.

<CodeGroup>
  ```python Python theme={"system"}
  import os
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.promptguard.co/api/v1",
      api_key=os.environ["MISTRAL_API_KEY"],  # forwarded to Mistral
      default_headers={"X-API-Key": os.environ["PROMPTGUARD_API_KEY"]},
  )

  response = client.chat.completions.create(
      model="mistral-small-latest",
      messages=[{"role": "user", "content": "Hello!"}],
  )
  print(response.choices[0].message.content)
  ```

  ```typescript Node.js theme={"system"}
  import OpenAI from 'openai';

  const client = new OpenAI({
    baseURL: 'https://api.promptguard.co/api/v1',
    apiKey: process.env.MISTRAL_API_KEY, // forwarded to Mistral
    defaultHeaders: { 'X-API-Key': process.env.PROMPTGUARD_API_KEY },
  });

  const response = await client.chat.completions.create({
    model: 'mistral-small-latest',
    messages: [{ role: 'user', content: 'Hello!' }],
  });
  console.log(response.choices[0].message.content);
  ```

  ```bash cURL theme={"system"}
  curl https://api.promptguard.co/api/v1/chat/completions \
    -H "X-API-Key: $PROMPTGUARD_API_KEY" \
    -H "Authorization: Bearer $MISTRAL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"model": "mistral-small-latest", "messages": [{"role": "user", "content": "Hello!"}]}'
  ```
</CodeGroup>

To keep the Mistral key out of your application, [store it as a provider key](/gateway/provider-keys) under `mistral`. PromptGuard then sends the stored key and ignores the `Authorization` header you send.

## Auto-instrumentation

The SDKs do not patch `mistralai`. Python's `init()` names it in its startup warning when it is installed, so you know its calls are not scanned. Use the proxy.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.