Repolode
Mirascope

Mirascope/mirascope

A Python and TypeScript toolkit for calling any frontier LLM through one unified interface, with decorators for prompts, structured output and tool use.

Stars
1,535
Forks
154
Open issues
24
Last commit
2 days ago

What is it?

Mirascope is a library for working with large language models from Python and TypeScript. Instead of a heavy framework with its own abstractions, it provides a single interface for calling any frontier LLM, so switching providers is mostly a matter of changing the model string.

The main entry point is a decorator: a function that returns a prompt is wrapped with a model identifier such as anthropic/claude-sonnet-4-5, and calling the function returns a response object. Output can be parsed into a Pydantic model by passing a format argument, and tools defined with a decorator can be executed and fed back into the conversation to build a simple agent loop.

The repository is a monorepo containing the Python package, the TypeScript implementation, examples for both, the documentation site and shared docs content.

Key features

  • 01Calls multiple LLM providers through one unified model identifier format.
  • 02Defines prompts as decorated Python functions.
  • 03Parses model output into Pydantic models via a format argument.
  • 04Turns decorated functions into tools and executes tool calls in a loop.
  • 05Provides a TypeScript implementation alongside the Python package.

Use cases

  • Building an LLM feature in Python that needs structured JSON output.
  • Writing a small tool-using agent without adopting a large framework.
  • Switching between model providers without rewriting call sites.
  • Prototyping LLM calls in either Python or TypeScript projects.

Quick start

  1. 1

    Install Mirascope with uv

    uv add "mirascope[all]"
  2. 2

    Call an LLM with the @llm.call decorator and print the response

Things to know

  • Calling models requires an API key from the model provider.

In collections

Topics

FAQ

What is mirascope?
A Python and TypeScript toolkit for calling any frontier LLM through one unified interface, with decorators for prompts, structured output and tool use. Mirascope is a library for working with large language models from Python and TypeScript. Instead of a heavy framework with its own abstractions, it provides a single interface for calling any frontier LLM, so switching providers is mostly a matter of changing the model string.
Is mirascope free to use? What license does it have?
mirascope is open source under the MIT license. Check the license terms before using it in commercial products.
Is mirascope still maintained?
Actively maintained. The last commit to mirascope was on Nov 5, 2026.
What can I use mirascope for?
Building an LLM feature in Python that needs structured JSON output. Writing a small tool-using agent without adopting a large framework. Switching between model providers without rewriting call sites. Prototyping LLM calls in either Python or TypeScript projects.
How do I install mirascope?
Install Mirascope with uv: uv add "mirascope[all]" Call an LLM with the @llm.call decorator and print the response
Where can I get mirascope?
The source code and installation instructions are on GitHub: https://github.com/Mirascope/mirascope

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects