LLM toolkit for Python focused on type safety and developer experience. Self-described as 'the LLM anti-framework' — minimal abstractions over LLM provider APIs. Current version: 2.4.0 (Mar 2026). Three major API surfaces exist: v0 (class-based, deprecated), v1 (provider-specific decorators from mirascope.core), and v2 (unified llm module). LLMs trained before 2025 generate v1 patterns which still work but v2 is current.
pip install mirascopeVerified import paths — ran on the pinned version, not inferred.
Mirascope v2 unified llm module quickstart.
Replace 'from mirascope.core import openai; @openai.call(model)' with 'from mirascope import llm; @llm.call("openai/model")'.response.text() not response.content. format=Book not response_model=Book. response.parse() for structured output.
Use decorator-based approach. See migration guide at mirascope.com/docs/mirascope/getting-started/migration
v1 patterns work but migrate to llm module for new code.
pip install 'mirascope[openai]' or 'mirascope[anthropic]' etc.
Return the prompt string from the function body, or use @prompt_template decorator for docstring-style prompts.
Ensure the relevant API key environment variable is set before running your application (e.g., `export OPENAI_API_KEY='your_key_here'`). Alternatively, for cross-provider support, set `MIRASCOPE_API_KEY`.