{"id":149,"library":"mirascope","title":"Mirascope","description":"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.","status":"active","version":"2.4.0","language":"python","source_language":"en","source_url":"https://github.com/Mirascope/mirascope","tags":["mirascope","llm","python","structured-output","type-safe","decorator"],"install":[{"cmd":"pip install mirascope","lang":"bash","label":"Python (core)"},{"cmd":"pip install 'mirascope[openai]'","lang":"bash","label":"Python (with OpenAI)"},{"cmd":"pip install 'mirascope[anthropic]'","lang":"bash","label":"Python (with Anthropic)"}],"dependencies":[{"reason":"Required for structured output and type validation. Pydantic v2 required.","package":"pydantic","optional":false},{"reason":"Required for OpenAI provider. Install via mirascope[openai].","package":"openai","optional":true},{"reason":"Required for Anthropic provider. Install via mirascope[anthropic].","package":"anthropic","optional":true}],"imports":[{"wrong":"from mirascope import llm","symbol":"llm","correct":"from mirascope import llm"}],"quickstart":{"code":"# pip install 'mirascope[openai]'\nfrom mirascope import llm\nfrom pydantic import BaseModel\n\n# Simple call\n@llm.call('openai/gpt-4o-mini')\ndef recommend_book(genre: str):\n    return f'Recommend a {genre} book.'\n\nprint(recommend_book('fantasy').text())\n\n# Structured output\nclass Book(BaseModel):\n    title: str\n    author: str\n\n@llm.call('openai/gpt-4o-mini', format=Book)\ndef recommend_structured(genre: str):\n    return f'Recommend a {genre} book.'\n\nbook = recommend_structured('fantasy').parse()\nprint(f'{book.title} by {book.author}')","lang":"python","description":"Mirascope v2 unified llm module quickstart."},"warnings":[{"fix":"Replace 'from mirascope.core import openai; @openai.call(model)' with 'from mirascope import llm; @llm.call(\"openai/model\")'.","message":"v2 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').","severity":"breaking","affected_versions":">= 2.0.0"},{"fix":"response.text() not response.content. format=Book not response_model=Book. response.parse() for structured output.","message":"Response access changed in v2. v1 used response.content, v2 uses response.text(). response_model= renamed to format=. .parse() method added for structured output.","severity":"breaking","affected_versions":">= 2.0.0"},{"fix":"Use decorator-based approach. See migration guide at mirascope.com/docs/mirascope/getting-started/migration","message":"v0 class-based approach (OpenAIChat, AnthropicChat classes) completely removed in v1+. All tutorials using class instantiation are broken.","severity":"breaking","affected_versions":">= 1.0.0"},{"fix":"v1 patterns work but migrate to llm module for new code.","message":"v1 (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.","severity":"gotcha","affected_versions":">= 2.0.0"},{"fix":"pip install 'mirascope[openai]' or 'mirascope[anthropic]' etc.","message":"Provider extras must be installed separately. 'pip install mirascope' alone gives ImportError when using provider-specific features.","severity":"gotcha","affected_versions":"all"},{"fix":"Return the prompt string from the function body, or use @prompt_template decorator for docstring-style prompts.","message":"Docstring-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.","severity":"gotcha","affected_versions":">= 2.0.0"},{"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`.","message":"Mirascope 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.","severity":"breaking","affected_versions":"all"}],"env_vars":null,"search_vec":"'2.4.0':30 '2025':58 '2026':32 'abstract':23 'anti':20 'anti-framework':19 'api':27,35 'base':41 'class':40 'class-bas':39 'current':28,68 'decor':47,78 'deprec':42 'describ':15 'develop':11 'exist':37 'experi':12 'focus':6 'framework':21 'generat':59 'llm':2,18,25,53,70 'llms':55 'major':34 'mar':31 'minim':22 'mirascop':1,69 'mirascope.core':49 'modul':54 'output':74 'pattern':61 'provid':26,45 'provider-specif':44 'python':5,71 'safe':77 'safeti':9 'self':14 'self-describ':13 'specif':46 'still':63 'structur':73 'structured-output':72 'surfac':36 'three':33 'toolkit':3 'train':56 'type':8,76 'type-saf':75 'unifi':52 'v0':38 'v1':43,60 'v2':51,66 'version':29 'work':64","created_at":"2026-03-24T04:43:54.578587+00:00","updated_at":"2026-04-16T16:33:12.092534+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":85,"quickstart_score":70,"quickstart_tag":"verified","pypi_latest":"2.4.0","cli_name":"mirascope","cli_version":"sh: 1: mirascope: not found","type":"library","homepage":"https://mirascope.com","github":"https://github.com/Mirascope/mirascope","docs":"https://mirascope.com/docs/mirascope/v2","changelog":"https://github.com/Mirascope/mirascope/releases","pypi":"https://pypi.org/project/mirascope/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["llm-agents","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-06-30","next_check":"2026-07-30","install_tag":"verified"}}