freshcrate
Skin:/
Home > Frameworks > mirascope

mirascope

The LLM Anti-Framework

Why this rank:Strong adoptionRelease freshnessHealthy release cadence

Description

The LLM Anti-Framework

README

Tests Coverage PyPI Version Python Versions License


Mirascope

Welcome to Mirascope, which allows you to use any frontier LLM with one unified interface.

Quick Start

Install Mirascope:

uv add "mirascope[all]"

Call LLMs with a Decorator

from mirascope import llm


@llm.call("anthropic/claude-sonnet-4-5")
def recommend_book(genre: str):
    return f"Recommend a {genre} book."


response = recommend_book("fantasy")
print(response.text())

Get Structured Output

from pydantic import BaseModel
from mirascope import llm


class Book(BaseModel):
    title: str
    author: str


@llm.call("anthropic/claude-sonnet-4-5", format=Book)
def recommend_book(genre: str):
    return f"Recommend a {genre} book."


book = recommend_book("fantasy").parse()
print(f"{book.title} by {book.author}")

Build an Agent with Tools

from pydantic import BaseModel
from mirascope import llm


class Book(BaseModel):
    title: str
    author: str


@llm.tool
def get_available_books(genre: str) -> list[Book]:
    """Get available books in the library by genre."""
    return [Book(title="The Name of the Wind", author="Patrick Rothfuss")]


@llm.call("anthropic/claude-sonnet-4-5", tools=[get_available_books], format=Book)
def librarian(request: str):
    return f"You are a librarian. Help the user: {request}"


response = librarian("I want a fantasy book")
while response.tool_calls:
    response = response.resume(response.execute_tools())
book = response.parse()
print(f"Recommending: {book.title} by {book.author}")

For streaming, async, multi-turn conversations, and more, see the full documentation.

Monorepo Structure

This project is structured as a monorepo, that conceptually divides into four parts:

  • python/ contains the Python implementation, and examples (in python/examples)
  • typescript/ contains the Typescript implementation, and examples (in typescript/examples)
  • website/ contains the marketing website (docs, blog, landing page)
  • docs/ contains the unified cross-language documentation (in docs/content), as well as configuration needed to build the docs

For detailed information about the codebase structure, architecture, and design decisions, see STRUCTURE.md.

Developing the site

Use bun run website:dev to launch the dev server.

Note that Bun must be installed.

CI and local testing

We currently have four CI jobs:

  • codespell: Checks for common misspellings including python, typescript, and docs repos
  • python-lint: Linting and typechecking for Python code
  • typescript-lint: Linting and typechecking for Typescript code
  • cloudflare docs build: Builds and previews the documentation site

You can run bun run ci in the root directory to run all CI checks locally. If adding new checks to GitHub CI, please also add it to the ci script in root package.json as well.

Versioning

Mirascope usesย Semantic Versioning.

License

This project is licensed under the MIT License.

Release History

VersionChangesUrgencyDate
v2.4.0## BREAKING We're unfortunately discontinuing Mirascope Cloud. The `api` module and anything else related to our cloud backend has been ripped out in this version so that it's a pure LLM SDK from now on. We will continue to build and maintain Mirascope the Python/TypeScript LLM library, but please find an alternative for your OTEL backend. ## What's Changed * chore: discontinue cloud by @willbakst in https://github.com/Mirascope/mirascope/pull/2856 **Full Changelog**: https://githLow3/8/2026
v2.3.0## What's Changed * fix: resolve dark mode styling for span signatures (#2164) by @vnkaralkar in https://github.com/Mirascope/mirascope/pull/2844 ## New Contributors * @sazed-verity made their first contribution in https://github.com/Mirascope/mirascope/pull/2751 * @vnkaralkar made their first contribution in https://github.com/Mirascope/mirascope/pull/2844 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v2.2.2...v2.3.0Low2/27/2026
v2.2.2## What's Changed * fix(cloud): OTEL intValue should accept number by @willbakst in https://github.com/Mirascope/mirascope/pull/2428 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v2.2.1...v2.2.2Low2/5/2026
v2.2.0## TypeScript SDK This release marks a major milestone for the TypeScript SDK with significant new capabilities (an alpha release with matching functionality to the Python SDK): ### New Features - MCP Support - Full Model Context Protocol support for building and consuming MCP servers - Structured Outputs - Define response schemas with Zod for type-safe structured responses, including streaming support - Tool Streaming - Stream tool calls as they're generated by the model - SubstrLow2/4/2026
v2.1.1## OpenRouterProvider It looks like the official `v2.1` release didn't actually have `OpenRouterProvider` due to a merge failure. This release fixes that. ## What's Changed * tests(ts): AnthropicProvider error wrapping by @willbakst in https://github.com/Mirascope/mirascope/pull/2137 * feat(ts): OpenAI + OpenAICompletions support (no Responses yet) by @willbakst in https://github.com/Mirascope/mirascope/pull/2139 * tests(ts): clean up tests to prefer e2e by @willbakst in https://github.Low2/1/2026
v2.1.0## Python SDK ### OpenRouter Provider Native support for https://openrouter.ai/ lets you access 200+ models through a single API. Use it to route requests through OpenRouter or access models not directly available from other providers: ```python from mirascope import llm # Register the provider llm.register_provider("openrouter", scope="openrouter/") @llm.call("openrouter/openai/gpt-4o") def my_prompt() -> str: return "Hello!" # Or route existing model prefixes through Low1/30/2026
v2.0.2## Key Fixes * Preserve metadata of original method when decorated (e.g. `__name__`) * Update organization invitation email validation regex so Python 3.12+ don't complain * Significant improvement to docs styling / structure for better navigation * Fixed broken discord links ## What's Changed * fix(cloud): color in mobile-menu hamburger by @sourishkrout in https://github.com/Mirascope/mirascope/pull/2094 * refactor(cloud): optimize redirects for single round trip by @sourishkrout in htLow1/23/2026
v2.0.1Minor bug fix replacing old instances of v2.mirascope.com with the correct mirascope.com/api/v2 ## What's Changed * fix: update instance of incorrect base url to be correct by @willbakst in https://github.com/Mirascope/mirascope/pull/2092 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v2.0.0...v2.0.1Low1/22/2026
v2.0.0## Documentation We've written extensive documentation for Mirascope v2! You can read it all here: https://mirascope.com/docs ## New Features ### Structured Output Improvements - Add support for primitive format types. You can now pass primitives like `str`, `int`, `list`, or `list[BaseModel]` to the `format=` argument on models, prompts, and calls. - Add support for structured streaming. Iterating over `stream_response.structured_stream()` will give partial structured outputs as tLow1/21/2026
v2.0.0-alpha.6## Thinking Support We've re-worked the thinking interface. Rather than simply setting thinking=True, you now provider a ThinkingConfig, like {"level": "medium", "include_summaries": True}. The ThinkingLevel is required, and options include "default", "none", "minimal", "low", "medium", "high", and "max". If include_summaries is True, then the model is asked to output summaries of its thoughts. Under the hood, Mirascope will convert the thinking level to the provider-specific representation. Low1/10/2026
v2.0.0-alpha.5Hello and happy holidays! Here are the short-but-sweet release notes for the latest Mirascope v2 Alpha Release. - Improved exception handling: All LLM calls now emit consistent exceptions, such as `llm.RateLimitError` or `llm.AuthenticationError`. You can learn more via our [API docs](https://mirascope.com/docs/mirascope/v2/api/exceptions), or by [reading the source](https://github.com/Mirascope/mirascope/blob/v2/python/mirascope/llm/exceptions.py). - Improved semantics for `Response.usage`. SLow12/31/2025
v2.0.0-alpha.4## Response usage tracking The `llm.Response` class now has a `.usage` property, which records provider token usage. When available, this will be set on both regular responses and stream responses. The `llm.Usage` class includes input tokens, output tokens and (when available with the chosen provider), cache read/write tokens and reasoning tokens. ## Anthropic strict structured outputs We now support strict structured response formatting with Anthropic, for supported models. Since this is stiLow12/19/2025
v2.0.0-alpha.3# Mirascope v2.0.0-alpha.3 Release Notes Hello everyone! We are pleased to announce the latest alpha release of Mirascope: v2.0.0-alpha.3. This release has an exciting new feature: the MLX Provider, allowing local inference on Apple Silicon for Macbook users. We also have a refactored provider system, where you can use `llm.register_provider` to configure what provider will be used for any given LLM model. This means you can now use Mirascope v2 with any OpenAI-compatible model, by registLow12/13/2025
v2.0.0-alpha.2## What's Changed * fix: resolve import error with python 3.13.9 by @teamdandelion in https://github.com/Mirascope/mirascope/pull/1497 * test: ensure tests are run against python 3.13 by @teamdandelion in https://github.com/Mirascope/mirascope/pull/1498 * fix: fix the website build by @teamdandelion in https://github.com/Mirascope/mirascope/pull/1501 * fix: add top level pyrightconfig that points to python/ by @teamdandelion in https://github.com/Mirascope/mirascope/pull/1499 * test: e2e ovLow11/15/2025
v1.25.7## What's Changed * Fix thinking stream reconstruction for Anthropic by @willbakst in https://github.com/Mirascope/mirascope/pull/1495 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.25.6...v1.25.7Low11/8/2025
v2.0.0-alpha.1## What's Changed * docs: write alpha intro docs by @teamdandelion in https://github.com/Mirascope/mirascope/pull/1479 * fix: include pydantic and httpx as required deps by @teamdandelion in https://github.com/Mirascope/mirascope/pull/1490 * fix: suppress MCP import errors by @teamdandelion in https://github.com/Mirascope/mirascope/pull/1491 * fix: handle missing provider packages gracefully by @teamdandelion in https://github.com/Mirascope/mirascope/pull/1492 * fix: upgrade deprecated toolLow11/6/2025
v2.0.0-alpha.0## What's Changed * Setup documentation site for v2 by @teamdandelion in https://github.com/Mirascope/mirascope/pull/991 * chore: cleanup v2 branch to only contain v2 code by @teamdandelion in https://github.com/Mirascope/mirascope/pull/992 * chore: remove Text content dataclass by @teamdandelion in https://github.com/Mirascope/mirascope/pull/1026 * V2 docs cloudflare by @willbakst in https://github.com/Mirascope/mirascope/pull/1028 * chore: update comment on robots.txt disallow for v2 by @Low11/6/2025
v1.25.6## What's Changed * feat: add Chroma Cloud support by @kylediaz in https://github.com/Mirascope/mirascope/pull/1189 * fix: issue with mistral client when not set at a global level by @willbakst in https://github.com/Mirascope/mirascope/pull/1212 * fix: update fallback to use context so it can work with streaming by @willbakst in https://github.com/Mirascope/mirascope/pull/1211 ## New Contributors * @kylediaz made their first contribution in https://github.com/Mirascope/mirascope/pull/1189Low8/14/2025
v1.25.5## What's Changed * Fix _load_media fails with HTTP 403 Forbidden due to missing User-Agent #1172 by @emilioramirez in https://github.com/Mirascope/mirascope/pull/1173 ## New Contributors * @emilioramirez made their first contribution in https://github.com/Mirascope/mirascope/pull/1173 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.25.4...v1.25.5Low8/5/2025
v1.25.4## What's Changed * Fix inconsistent partial structured streaming by @willbakst in https://github.com/Mirascope/mirascope/pull/1106 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.25.3...v1.25.4Low7/7/2025
v1.25.3## What's Changed * fix: include tool description when creating tools from MCP by @matinone in https://github.com/Mirascope/mirascope/pull/1102 ## New Contributors * @matinone made their first contribution in https://github.com/Mirascope/mirascope/pull/1102 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.25.2...v1.25.3Low7/4/2025
v1.25.2## What's Changed * fix upload images if payload size exeed 5MB when using vertex ai by @CharlesOural in https://github.com/Mirascope/mirascope/pull/995 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.25.1...v1.25.2Low6/23/2025
v1.25.1## What's Changed * fix langfuse integration bug? by @hyusap in https://github.com/Mirascope/mirascope/pull/990 ## New Contributors * @hyusap made their first contribution in https://github.com/Mirascope/mirascope/pull/990 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.25.0...v1.25.1Low6/18/2025
v1.25.0## What's Changed * feat: add Anthropic support for thinking by @teamdandelion in https://github.com/Mirascope/mirascope/pull/984 * feat: support response_model with anthropic thinking by @teamdandelion in https://github.com/Mirascope/mirascope/pull/988 * Implement thinking support for Google by @teamdandelion in https://github.com/Mirascope/mirascope/pull/986 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.24.2...v1.25.0Low6/7/2025
v1.24.2## What's Changed * fix(MCP): default value for non-nullable fields should not be None by @murtaza64 in https://github.com/Mirascope/mirascope/pull/980 * fix: issue with mcp tool fields with no default when not required by @willbakst in https://github.com/Mirascope/mirascope/pull/982 ## New Contributors * @murtaza64 made their first contribution in https://github.com/Mirascope/mirascope/pull/980 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.24.1...v1.24.2Low6/2/2025
v1.24.1## What's Changed * fix: issue with in tool outputs breaking serialization by @willbakst in https://github.com/Mirascope/mirascope/pull/975 * fix: issue with incorrect use of 'name' field with bedrock tools by @willbakst in https://github.com/Mirascope/mirascope/pull/976 * Fix: tool calls with bedrock by @alexanderlazarev0 in https://github.com/Mirascope/mirascope/pull/977 * fix: issue with azure streaming due to NoneType usage in chunk by @willbakst in https://github.com/Mirascope/mirascopLow5/24/2025
v1.24.0## What's Changed * Add support for Gemini Document Understanding by @listlessbird in https://github.com/Mirascope/mirascope/pull/966 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.23.4...v1.24.0Low5/18/2025
v1.23.4## What's Changed * Add api ref structure back by @willbakst in https://github.com/Mirascope/mirascope/pull/969 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.23.3...v1.23.4Low5/16/2025
v1.23.3## What's Changed * fix: enhance fn_is_async to check for async wrappers by @koxudaxi in https://github.com/Mirascope/mirascope/pull/967 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.23.2...v1.23.3Low5/11/2025
v1.23.2## What's Changed * Add metadata support to OpenAI call parameters by @listlessbird in https://github.com/Mirascope/mirascope/pull/964 ## New Contributors * @listlessbird made their first contribution in https://github.com/Mirascope/mirascope/pull/964 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.23.1...v1.23.2Low5/7/2025
v1.23.1## What's Changed * Fix mistral empty tool by @willbakst in https://github.com/Mirascope/mirascope/pull/962 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.23.0...v1.23.1Low5/6/2025
v1.23.0## What's Changed * Add support for streaming tools with Google by @willbakst in https://github.com/Mirascope/mirascope/pull/960 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.22.6...v1.23.0Low5/6/2025
v1.22.6## What's Changed * Fix issue with `GoogleCallResponseChunk` content handling by @willbakst in https://github.com/Mirascope/mirascope/pull/955 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.22.5...v1.22.6Low4/30/2025
v1.22.5## What's Changed * Add missing `google` and `xai` examples by @willbakst in https://github.com/Mirascope/mirascope/pull/950 * Fix issue with OpenAI message conversion from `BaseMessageParam` with multiple tool calls by @willbakst in https://github.com/Mirascope/mirascope/pull/953 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.22.4...v1.22.5Low4/30/2025
v1.22.4## What's Changed * fix: llm call now has __mirascope_call__ by @brenkao in https://github.com/Mirascope/mirascope/pull/946 * fix: google module common message param conversion role issue by @willbakst in https://github.com/Mirascope/mirascope/pull/948 * fix: issue with docs model choice for groq (out of date) by @willbakst in https://github.com/Mirascope/mirascope/pull/949 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.22.3...v1.22.4Low4/22/2025
v1.22.3## What's Changed * fix: Tool usage with llm.call by @teamdandelion in https://github.com/Mirascope/mirascope/pull/941 * Fix google tool by @teamdandelion in https://github.com/Mirascope/mirascope/pull/942 * Fix `llm.call` tool looping with anthropic by @willbakst in https://github.com/Mirascope/mirascope/pull/943 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.22.2...v1.22.3Low4/16/2025
v1.22.2## What's Changed * feat: verify uv.lock is up-to-date in CI by @teamdandelion in https://github.com/Mirascope/mirascope/pull/933 * Fix google call params error 936 by @ionflow in https://github.com/Mirascope/mirascope/pull/937 ## New Contributors * @ionflow made their first contribution in https://github.com/Mirascope/mirascope/pull/937 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.22.1...v1.22.2Low4/2/2025
v1.22.1## What's Changed * feat: serve_docs_dev.py for fast docs development by @teamdandelion in https://github.com/Mirascope/mirascope/pull/926 * fix: missing proto-plus dep for google extra by @willbakst in https://github.com/Mirascope/mirascope/pull/932 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.22.0...v1.22.1Low3/22/2025
v1.22.0## What's Changed * Mirascope MCP Client (`stdio_client` and `sse_client` context managers) by @willbakst in https://github.com/Mirascope/mirascope/pull/919 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.21.6...v1.22.0Low3/14/2025
v1.21.6## What's Changed * (experimental) feat: FiniteStateMachine type-safe interface (without compilation) by @willbakst in https://github.com/Mirascope/mirascope/pull/917 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.21.5...v1.21.6Low3/12/2025
v1.21.5## What's Changed * fix: fix CallResponse common messages by @koxudaxi in https://github.com/Mirascope/mirascope/pull/915 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.21.4...v1.21.5Low3/12/2025
v1.21.4## What's Changed * fix: make llm.context work for async functions by @teamdandelion in https://github.com/Mirascope/mirascope/pull/909 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.21.3...v1.21.4Low3/10/2025
v1.21.3## What's Changed * Fix bedrock env vars by @willbakst in https://github.com/Mirascope/mirascope/pull/907 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.21.2...v1.21.3Low3/10/2025
v1.21.2## What's Changed * Consolodate Gemini and Vertex references in docs by @fazilraja in https://github.com/Mirascope/mirascope/pull/900 * Fix 902 and 903 by @willbakst in https://github.com/Mirascope/mirascope/pull/905 ## New Contributors * @fazilraja made their first contribution in https://github.com/Mirascope/mirascope/pull/900 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.21.1...v1.21.2Low3/10/2025
v1.21.1## What's Changed * Fix 899 by @willbakst in https://github.com/Mirascope/mirascope/pull/901 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.21.0...v1.21.1Low3/9/2025
v1.21.0## What's Changed * feat: migrate async.md to provider-agnostic calls by @teamdandelion in https://github.com/Mirascope/mirascope/pull/883 * feat: migrate retries.md to llm.call by @teamdandelion in https://github.com/Mirascope/mirascope/pull/885 * Blog Posts: Prompt Evaluation, LLM Chaining, LLM Integration by @willbakst in https://github.com/Mirascope/mirascope/pull/886 * blog: add some bolding by @orlando21 in https://github.com/Mirascope/mirascope/pull/888 * Release v1.21 by @willbakst Low3/9/2025
v1.20.1## What's Changed * Fix cost imports and API docs by @willbakst in https://github.com/Mirascope/mirascope/pull/882 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.20.0...v1.20.1Low2/28/2025
v1.20.0## What's Changed * feat: (mostly) migrate calls.md to provider-agnostic usage by @teamdandelion in https://github.com/Mirascope/mirascope/pull/869 * adjust examples to be fully self-contained by @samyk in https://github.com/Mirascope/mirascope/pull/873 * feat: Implement unified cost tracking API across all providers by @koxudaxi in https://github.com/Mirascope/mirascope/pull/874 * feat: streams.md has provider agnostic calls by @teamdandelion in https://github.com/Mirascope/mirascope/pull/8Low2/28/2025
v1.19.0## What's Changed * v1.19 by @willbakst in https://github.com/Mirascope/mirascope/pull/868 **Full Changelog**: https://github.com/Mirascope/mirascope/compare/v1.18.4...v1.19.0Low2/21/2025
v1.18.4## What's Changed * fix: missing reasoning_effort call param for openai by @willbakst in https://github.com/Mirascope/mirascope/pull/844 * fix: call response tool message param typing issue by @willbakst in https://github.com/Mirascope/mirascope/pull/843 * fix: incorrect exclusion of custom titles for fields in base models by @willbakst in https://github.com/Mirascope/mirascope/pull/846 * tests: directly test GenerateJsonSchemaNoTitles by @willbakst in https://github.com/Mirascope/mirascope/Low2/21/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

langgraphjsFramework to build resilient language agents as graphs.@langchain/svelte@1.0.16
aitoolmanControllable and Transparent LLM Application Frameworkmain@2026-05-30
ag-clawModular AI agent framework with 59 pluggable features, 8+ messaging channels, and production-grade security. TypeScript-first. MIT license. Self-hosted, no subscriptions.v0.0.7
loquixA framework-agnostic UI kit of production-ready components for building AI and LLM chat interfaces.@loquix/react@0.2.0
edslDesign, conduct and analyze results of AI-powered surveys and experiments. Simulate social science and market research with large numbers of AI agents and LLMs.wasm-wheel

More in Frameworks

langchainThe agent engineering platform
deer-flowAn open-source long-horizon SuperAgent harness that researches, codes, and creates. With the help of sandboxes, memories, tools, skill, subagents and message gateway, it handles different levels of ta
tqdmFast, Extensible Progress Meter
simBuild, deploy, and orchestrate AI agents. Sim is the central intelligence layer for your AI workforce.