# Mistral AI — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.paywithlocus.com/llms.txt)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API |
> |---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Premier and open-source LLMs — Mistral Large, Medium, Small, Codestral, Magistral reasoning, Pixtral vision, text embeddings, and content moderation.

**Category:** AI / LLM | **Website:** [mistral.ai](https://mistral.ai) | **Docs:** [docs.mistral.ai](https://docs.mistral.ai)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/mistral/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

> Also available via public x402 on Base (no account needed): [x402/mistral.md](https://beta.paywithlocus.com/x402/mistral.md)

> Also available via MPP (no account needed): [mpp/mistral.md](https://beta.paywithlocus.com/mpp/mistral.md)

## Endpoints

### Chat Completion

Create a chat completion. Supports function calling, JSON mode, structured output, vision, reasoning, web search, and document context.

**Estimated cost:** Usage-based; the 402 challenge advertises the authorization maximum

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `model` | string | Yes | Model ID (e.g. "mistral-large-latest", "codestral-latest") |
| `messages` | array | Yes | Conversation messages array |
| `max_tokens` | number | Yes | Maximum output tokens. Required to bound metered x402 authorization. |
| `temperature` | number | No | Sampling temperature (0-2) |
| `top_p` | number | No | Nucleus sampling (0-1) |
| `tools` | array | No | Tool/function definitions |
| `tool_choice` | string/object | No | Tool selection control |
| `response_format` | object | No | Output format (json_object, json_schema, text) |
| `stop` | string/array | No | Stop sequences |
| `seed` | number | No | Deterministic sampling seed |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/mistral/chat \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<string>","messages":"<array>","max_tokens":"<number>","temperature":"<number>","top_p":"<number>","tools":"<array>","tool_choice":"<string/object>","response_format":"<object>","stop":"<string/array>","seed":"<number>"}'
```

### Embeddings

Generate text or code embeddings. Returns 1024-dimensional vectors for retrieval, clustering, and classification.

**Estimated cost:** Usage-based; the 402 challenge advertises the authorization maximum

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `model` | string | Yes | Embedding model (e.g. "mistral-embed", "codestral-embed") |
| `input` | string/array | Yes | Text(s) to embed (string or array of strings) |
| `encoding_format` | string | No | Output format: "float" (default) or "base64" |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/mistral/embed \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<string>","input":"<string/array>","encoding_format":"<string>"}'
```

### Moderation

Classify content for safety across categories: violence, hate speech, sexual content, self-harm, and more.

**Estimated cost:** $0.008

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `model` | string | Yes | Moderation model (e.g. "mistral-moderation-latest") |
| `input` | string/array | Yes | Text(s) to moderate (string or array of strings) |

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/mistral/moderate \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"<string>","input":"<string/array>"}'
```

### List Models

List all available Mistral models with metadata.

**Estimated cost:** $0.005 fee only

_No parameters required._

```bash
curl -X POST https://api.beta.paywithlocus.com/api/wrapped/mistral/models \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```
