Skip to main content

llm-api-adapter-mistral

Official direct-API support for Mistral in llm-api-adapter.

Installation

Install through the core package extra (recommended):

pip install "llm-api-adapter[mistral]"

Direct installation remains supported when the core package is already managed separately:

pip install llm-api-adapter-mistral

Quick start

import os

from llm_api_adapter.models.messages.chat_message import UserMessage
from llm_api_adapter.universal_adapter import UniversalLLMAPIAdapter

adapter = UniversalLLMAPIAdapter(
    organization="mistral",
    model="mistral-large-2512",
    api_key=os.environ["MISTRAL_API_KEY"],
)

response = adapter.chat(messages=[UserMessage("Explain retrieval-augmented generation.")])
print(response.content)

Capabilities

  • Chat, tool calling, structured JSON output, and image input.
  • Synchronous and asynchronous chat and streaming.
  • PDF URLs and bytes through Mistral OCR.
  • Tool loops use explicit message history: append the assistant tool calls and ToolMessage results before the next request. previous_response is accepted for the shared API contract but is not sent to Mistral, whose Chat Completions API is stateless.

See the main llm-api-adapter README for the shared API contract and examples.

Structured-output portability

This package requires llm-api-adapter>=0.9.2,<1.0.0 and enforces the same Core portable JSON Schema profile as OpenAI, Anthropic, Google, and xAI. The profile guarantees that every object is strict, every property is required, optional values are nullable, and only direct, non-recursive local #/$defs/... references are resolved before the request.

Use json_schema for parsed JSON only. Use a Pydantic response_model when the final result must also be locally validated and returned as ChatResponse.parsed_model; each nested Pydantic model must use ConfigDict(extra="forbid"). Refusal and incomplete terminal responses set ChatResponse.refusal or ChatResponse.incomplete_reason and leave parsed fields unset. Invalid completed JSON or failed Pydantic validation raises JSONSchemaError.

The complete schema vocabulary and examples are in the main Structured Output guide.

Supported models

  • mistral-small-2603
  • mistral-medium-3-5
  • mistral-large-2512

PDF input

DocumentPart supports PDF URLs and bytes. Before the chat request, the adapter sends each PDF to Mistral OCR 4.1 (mistral-ocr-4-1) and supplies the resulting Markdown to the selected chat model. This creates a separate OCR API request, subject to Mistral's OCR limits and pricing; ChatResponse usage and cost cover only the chat completion.

Metadata

Release files for llm-api-adapter-mistral 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-api-adapter-mistral 0.1.1
File Size Uploaded Provenance Actions
llm_api_adapter_mistral-0.1.1.tar.gz 17.1 kB Without provenance Details for llm_api_adapter_mistral-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-api-adapter-mistral 0.1.1
File Interpreter ABI Platform Actions
llm_api_adapter_mistral-0.1.1-py3-none-any.whl Python 3 none any Details for llm_api_adapter_mistral-0.1.1-py3-none-any.whl

Total release size: 34.0 kB

Release files / llm_api_adapter_mistral-0.1.1.tar.gz

Download URL llm_api_adapter_mistral-0.1.1.tar.gz
Size 17.1 kB
Tags Source
SHA-256 checksum
How to use checksums
721cf2cacd5a0c369fc763ea8cfe4358e35f2114d25ec8eb74e69603710aead9
BLAKE2b-256 checksum
How to use checksums
bd8801bc9948ee6f92c5ff80af4a90a3b3b970c1ce43397168f752efb4257407
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / llm_api_adapter_mistral-0.1.1-py3-none-any.whl

Download URL llm_api_adapter_mistral-0.1.1-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c469867e1fa97e29694dfd18bd6a31915f96a91b18a2798b545ead4e453ed09e
BLAKE2b-256 checksum
How to use checksums
a6222855fda3ff5689bb5aa939e2de9d249dccd33fb4f9efd445af85f05d3004
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for llm-api-adapter-mistral 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page