Registry / llm-agents / mirascope

mirascope

JSON →
library2.4.0pypypi✓ verified 50d ago

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.

llm-agentsai-ml
pip install mirascope
Install & Compatibility
Where this runs
tested against v2.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 5.5s
py 3.11
✓ —
✓ 4.86s
py 3.12
✓ —
✓ 4.12s
py 3.13
✓ —
✓ 4.26s
py 3.9
9/15 runs
9/15 runs
52MB installed
● package 52MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

llm
from mirascope import llm
from mirascope import llm

Mirascope v2 unified llm module quickstart.

# pip install 'mirascope[openai]' from mirascope import llm from pydantic import BaseModel # Simple call @llm.call('openai/gpt-4o-mini') def recommend_book(genre: str): return f'Recommend a {genre} book.' print(recommend_book('fantasy').text()) # Structured output class Book(BaseModel): title: str author: str @llm.call('openai/gpt-4o-mini', format=Book) def recommend_structured(genre: str): return f'Recommend a {genre} book.' book = recommend_structured('fantasy').parse() print(f'{book.title} by {book.author}')
mirascope --version
Debug
Known issues
breakingv2 replaced provider-specific imports with unified 'from mirascope import llm'. Model strings now use 'provider/model' format (e.g. 'openai/gpt-4o-mini', 'anthropic/claude-sonnet-4-5').
fix
Replace 'from mirascope.core import openai; @openai.call(model)' with 'from mirascope import llm; @llm.call("openai/model")'.
affects: >= 2.0.0
breakingResponse access changed in v2. v1 used response.content, v2 uses response.text(). response_model= renamed to format=. .parse() method added for structured output.
fix
response.text() not response.content. format=Book not response_model=Book. response.parse() for structured output.
affects: >= 2.0.0
breakingv0 class-based approach (OpenAIChat, AnthropicChat classes) completely removed in v1+. All tutorials using class instantiation are broken.
fix
Use decorator-based approach. See migration guide at mirascope.com/docs/mirascope/getting-started/migration
affects: >= 1.0.0
gotchav1 (mirascope.core provider-specific imports) still works in v2 but is not the current API. LLMs trained on 2024 data will generate v1 patterns — functional but not idiomatic.
fix
v1 patterns work but migrate to llm module for new code.
affects: >= 2.0.0
gotchaProvider extras must be installed separately. 'pip install mirascope' alone gives ImportError when using provider-specific features.
fix
pip install 'mirascope[openai]' or 'mirascope[anthropic]' etc.
affects: all
gotchaDocstring-as-prompt pattern from v1 no longer default in v2. Function return value is now the prompt. Docstring-style still works via @prompt_template decorator.
fix
Return the prompt string from the function body, or use @prompt_template decorator for docstring-style prompts.
affects: >= 2.0.0
breakingMirascope requires API keys for providers to be set as environment variables (e.g., OPENAI_API_KEY for OpenAI, ANTHROPIC_API_KEY for Anthropic). Failing to set these will result in a `MissingAPIKeyError` at runtime.
fix
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`.
affects: all
Upgrade
Version history
2.4.0latest on PyPI
Audit
Dependencies
pydanticrequiredRequired for structured output and type validation. Pydantic v2 required.
openaioptionalRequired for OpenAI provider. Install via mirascope[openai].
anthropicoptionalRequired for Anthropic provider. Install via mirascope[anthropic].
Agent activity
12 hits · last 30 days
node
4
seranking-bot
4
ahrefsbot
2
bingbot
1
Resources