l / MISTRAL_API_TUTORIAL.md
KiWA001's picture
Add self-heal brain and heartbeat tuning
fc4613c
|
Raw
History Blame Contribute Delete
1.05 kB

Overview This project currently uses Mistral's chat completions API in app/api/chat/route.ts.

Current Configuration

  • Endpoint: https://api.mistral.ai/v1/chat/completions
  • Model: mistral-tiny
  • API key (hardcoded in app/api/chat/route.ts): lzWRBwuWxwTGkihMcR4jCicHNpFGiKmA
  • HTTP method: POST
  • Content-Type: application/json

Where It Lives

  • File: app/api/chat/route.ts
  • Fetch call location: the fetch('https://api.mistral.ai/v1/chat/completions', ...) block.

Request Shape The request payload is built like this:

{
  "model": "mistral-tiny",
  "messages": [
    { "role": "system", "content": "..." },
    { "role": "user", "content": "..." }
  ],
  "max_tokens": 1500,
  "temperature": 0.7
}

Header Shape

Content-Type: application/json
Authorization: Bearer lzWRBwuWxwTGkihMcR4jCicHNpFGiKmA

Note The API key is currently embedded in source code. If you want, I can move it to environment variables (for example MISTRAL_API_KEY) and update the code to read from process.env.