# DSPy

> Framework for programming—not just prompting—language-model pipelines and agents.

- Website: https://dspy.ai
- Category: AI Models & APIs
- Source page: https://opendirs.com/en/tools/dspy
- Pricing: Open source
- Starting price: $0
- Public API: Yes
- Open source: Yes
- Chinese language: No
- Accessible from mainland China: Unknown
- Platforms: Unknown
- Country: United States
- Last verified: Nov 28, 2026

## Overview

DSPy, from Stanford, is a framework for building LLM pipelines as programs rather than piles of hand-tuned prompts. You define modules, signatures, and metrics, then let DSPy optimize the prompts or weights against those metrics. It has become a core tool for teams that want systematic, testable LLM systems instead of prompt folklore.

**Best for:** Teams that want to treat LLM pipelines as optimizable programs.

## Key features

- Programmatic modules and signatures instead of one-off prompts
- Optimization loops that tune prompts or weights against metrics
- Suitable for RAG, agents, and multi-step LLM systems
- Open source, with a growing ecosystem around the core library

## Use cases

- Replacing a fragile chain of manual prompts with a DSPy program
- Optimizing a RAG pipeline against a held-out quality metric
- Iterating on an agent workflow without rewriting prompts by hand each time

## Pros

- Shifts LLM work from prompt folklore to something closer to software
- Open source and well known in the research and applied-ML community
- Encourages evaluation-driven development

## Cons

- There is a learning curve if you are used to raw prompt files
- Optimization jobs add complexity and compute cost

## Alternatives

- [NeMo Guardrails](https://opendirs.com/en/tools/nemo-guardrails.md)
- [Guardrails AI](https://opendirs.com/en/tools/guardrails-ai.md)
- [Hugging Face](https://opendirs.com/en/tools/hugging-face.md)
- [AI21 Post-Training (Lab-as-a-Service)](https://opendirs.com/en/tools/ai21-post-training-lab-as-a-service.md)
- [Together AI](https://opendirs.com/en/tools/together-ai.md)

## FAQ

### What is DSPy?

DSPy, from Stanford, is a framework for building LLM pipelines as programs rather than piles of hand-tuned prompts. You define modules, signatures, and metrics, then let DSPy optimize the prompts or weights against those metrics. It has become a core tool for teams that want systematic, testable LLM systems instead of prompt folklore.

### Is DSPy free?

DSPy uses a Open source pricing model (verified Nov 28, 2026).

### Does DSPy have an API?

Yes. DSPy offers an API for developers.

### Does DSPy support Chinese, and is it available in China?

DSPy does not support Chinese, and it has unverified availability in mainland China.

### What are the best alternatives to DSPy?

Popular alternatives to DSPy include NeMo Guardrails, Guardrails AI, Hugging Face, AI21 Post-Training (Lab-as-a-Service).

_Last verified: Nov 28, 2026_