{"library":"mistralai","code":"import os\nfrom mistralai.client import Mistral\n\n# Ensure MISTRAL_API_KEY environment variable is set\napi_key = os.environ.get('MISTRAL_API_KEY', '')\n\nif not api_key:\n    print(\"Error: MISTRAL_API_KEY environment variable not set.\")\n    print(\"Please set it using: export MISTRAL_API_KEY='your_api_key_here'\")\nelse:\n    try:\n        client = Mistral(api_key=api_key)\n        chat_response = client.chat.complete(\n            model=\"mistral-small-latest\",\n            messages=[\n                {\"role\": \"user\", \"content\": \"What is the capital of France?\"}\n            ]\n        )\n        print(chat_response.choices[0].message.content)\n    except Exception as e:\n        print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart initializes the Mistral client and performs a simple chat completion request. It assumes the `MISTRAL_API_KEY` environment variable is set for authentication. The response content is then printed.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":1},{"runtime":"python:3.9-slim","exit_code":1}]}