Skip to content

DSPy

DSPy is an open source Python framework for building AI systems by describing tasks as structured signatures instead of hand-written prompts. It started at Stanford NLP and is released under the MIT license. It requires Python 3.10 or later and installs with pip install -U dspy.

By Stanford NLP and the open source communityOpen sourceLLM Frameworks

Facts checked on against the sources listed at the end of this page.

Pricing
Open sourceFree plan: Yes: free and open source
Open source
YesMIT

A good fit for

  • Teams that want to optimize prompts against a metric instead of editing them by hand
  • Programs that must keep working when the underlying model changes
  • Research and production projects that build multi-step LLM pipelines in Python

Not a good fit for

  • Non-Python projects
  • Quick demos where writing one prompt is faster than defining signatures and a metric
  • Teams that want a hosted product with a vendor to call

DSPy pricing

DSPy is free and open source under the MIT license. You pay only for the model providers you call.

Prices in USD, checked on 14 October 2026. Current prices on dspy.ai.

Main features

Signatures
Typed inputs and outputs for a task.
Modules
Swappable strategies: direct prediction, chain-of-thought and ReAct agents with tools.
Optimizers
Tune a program against a metric, for example with GEPA.
Multimodal support
Images as signature field types.

About DSPy

With DSPy you describe what a step should do, with typed inputs and outputs, and DSPy handles the prompting. That makes programs easier to maintain and modify when you change models.

Signatures define a task. Modules are swappable ways to run it, such as direct prediction, chain-of-thought reasoning or ReAct agents with tools. Optimizers, such as GEPA, tune a program against a metric you define.

Images can be used as signature field types for multimodal tasks.

Made by
Stanford NLP and the open source community
Free plan
Yes: free and open source
Available on
Python 3.10 or later

DSPy alternatives

All 7 alternatives to DSPy, side by side

Getting started

  1. Install DSPy.

    pip install -U dspy

Questions about DSPy

Is DSPy free?

Yes. It is open source under the MIT license.

Who makes DSPy?

DSPy started at Stanford NLP and now has a broad open source community.

How do I install DSPy?

Run pip install -U dspy. It needs Python 3.10 or later.

What does DSPy do differently from prompting?

You declare typed signatures and modules, and optimizers tune the program against a metric, instead of editing prompt text by hand.

Sources and links

Work on DSPy? Claim this listing. Something wrong or out of date? Suggest a correction. Stats come from the public GitHub and npm APIs and update every day.

DSPy: pricing, features and alternatives (2026) | ScratchDB