skills/ai-apis/mistral-api/SKILL.md
Mistral AI API for models like large/medium/small, with function calling and code generation.
npx skillsauth add alphaonedev/openclaw-graph mistral-apiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill enables interaction with the Mistral AI API, providing access to models like Mistral Large, Medium, and Small for tasks such as text generation, function calling, and code creation. It's designed for developers needing advanced AI capabilities via a RESTful API.
To use this skill, set up authentication with your Mistral API key via environment variable (e.g., export MISTRAL_API_KEY=your_key). Then, make HTTP requests to the base endpoint https://api.mistral.ai/v1. Always specify the model in requests for targeted performance. For function calling, include a "tools" array in the payload. Integrate via HTTP clients like requests in Python or fetch in JavaScript. Handle responses asynchronously to manage streaming data.
https://api.mistral.ai/v1/chat/completions
Authorization: Bearer $MISTRAL_API_KEY, Content-Type: application/json{"model": "mistral-large", "messages": [{"role": "user", "content": "Hello"}], "tools": [{"type": "function", "function": {"name": "get_weather"}}]}curl -X POST -H "Authorization: Bearer $MISTRAL_API_KEY" -H "Content-Type: application/json" -d '{"model":"mistral-medium","messages":[{"role":"user","content":"Write a Python function"}]}' https://api.mistral.ai/v1/chat/completionshttps://api.mistral.ai/v1/embeddings
input as an array of strings; specify model like "mistral-small".{"input": ["Hello world"], "model": "mistral-small"}.env files as MISTRAL_API_KEY=sk-mistral-....stream: true in payload for streaming; use max_tokens: 512 to limit response length.export MISTRAL_API_KEY=your_api_key before running scripts.requests in Python: import os; api_key = os.environ.get('MISTRAL_API_KEY').if response.status_code == 429: time.sleep(10); retry_request().To generate a simple Python function using Mistral API:
export MISTRAL_API_KEY=your_keycurl -X POST -H "Authorization: Bearer $MISTRAL_API_KEY" -H "Content-Type: application/json" -d '{"model": "mistral-medium", "messages": [{"role": "user", "content": "Write a function to add two numbers in Python"}]}' https://api.mistral.ai/v1/chat/completions{"choices": [{"message": {"content": "def add(a, b): return a + b"}}]}To use function calling for weather data:
{"tools": [{"type": "function", "function": {"name": "get_weather", "parameters": {"location": "string"}}}]response = requests.post('https://api.mistral.ai/v1/chat/completions', headers={'Authorization': f'Bearer {os.environ["MISTRAL_API_KEY"]}'}, json={'model': 'mistral-large', 'messages': [{'role': 'user', 'content': 'Get weather for New York'}], 'tools': [...]})get_weather function.tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui