- Public OpenAI-style lm(messages=[...]) calls, including SDK message objects. Use explicit requests as above.
- Custom BaseLM.forward() and aforward() integrations. Implement the engine interface.
- LegacyEngine, AsyncLegacyEngine, and custom completelegacy() shortcuts. These are transition tools, not permanent escape hatches.
- Native n answers use separate sequential requests, potentially billing input tokens more than once. Use engine="litellm" for that backend's native n behavior.
- Custom engine objects own their connection. Put apikey, apibase, timeout, and related client settings on the engine itself; DSPy rejects them on LM construction, copying, and calls with custom…
- Custom engines need importable classes and JSON-compatible dumpstate()/loadstate() implementations to save and restore. Restoring them requires allowunsafelmstate=True; only enable it for trusted…
DSPy by Stanford NLP
Overview
A framework for programming language models with declarative modules and optimizers instead of hand-written prompts.
DSPy was downloaded 1.4M times from PyPI in the week ending Oct 4, 2026, up 4.8% on the week before and down 13.9% over the last 30 days compared with the 30 before. The GitHub repository has 38.5K stars, 763 of them added in the last 30 days. The latest stable release is 3.4.0, published Sep 25, 2026; there were 1 stable releases in the past 30 days. It was mentioned in 13 Hacker News posts and comments over the last 30 days.
DSPy usage and attention over time
Download the raw daily series: dspy.csv
Install DSPy
| PyPI | pip install dspy |
|---|
These commands use the packages tracked on this page. The vendor may recommend a different installer.
Key facts
| Maker | Stanford NLP |
|---|---|
| Type | Prompt programming framework |
| License | MIT |
| Interfaces | Python library |
| Main language | Python |
| Open issues and PRs | 770 |
Pricing
DSPy is open source and free to use; you pay only for the models and infrastructure it runs on.
, checked Oct 5, 2026. Prices change often; confirm before you buy.
Pulse Score breakdown
Each component is scored 0 to 100 from public signals; a dash means no data for it. Methodology.
What changed: recent DSPy releases
3 stable releases in the last 90 days · Full changelog
- unsolicited sandbox diagnostics can no longer desynchronize JSON-RPC replies;
- request IDs are unpredictable, and recursive execution through one of an
- bundled runtime files are protected and Deno-cache access is revoked after
- mounted files with distinct host paths cannot silently collide at the same
- guest code cannot change host-tool identity by mutating JavaScript globals or
- interpreter execution start and end;
- paralleltoolcalls support: DSPy preserves each call/result pair by ID. You can do this in native mode or in non-native mode
- Multi-turn native tool call support: Prior tool calls and results can be replayed as assistant and tool messages instead of being flattened into prompt text.
- Each turn lives in dspy.History as structured messages rather than one ever-growing trajectory string, so providers with prompt caching can reuse stable prefixes more effectively. We have seen up…
- LiteLLM can become an optional compatibility fallback in the planned 3.5+ path, instead of a required part of the core LM contract.
- Custom LM authors can implement one typed LMRequest -> LMResponse path instead of guessing which OpenAI/LiteLLM-shaped inputs will arrive.
- Custom LMs can translate between DSPy's typed objects and their own provider, local runtime, gateway, or inference stack.
- Removed the upper bound on litellm. (#9687)
- Usecase page has been updated! To add your use-case, open a PR!
- Fixed async streaming LM calls so custom headers are forwarded to LiteLLM streaming completions. (#9669)
- Fixed dspy.Embedder so per-call caching=False is honored for both sync and async embedding calls. (#9708)
- Moved Deployment into the technical documentation tabs and promoted production use cases under Community. (#9709)
- Updated the production use-cases copy for DSPy.
- Make BetterTogether compatible with all optimizers
- feat: add verify parameter to Image for SSL bypass
- feat(signature): add type validation for input fields
- feat: add file output support to inspecthistory and fix return type
- feat: make optuna optional
- feat(retrievers): add EmbeddingsWithScores for similarity score access
- fix(interpreter): Fix enablereadpaths with multiple files
- fix: handle dict response in RLM for reasoning models
- feat(CodeInterpreter): Convert messaging format to JSONRPC
- feat(RLMs): Fix code fence parsing
- fix(RLM): large variable injection
- fix(RLM): no longer get stuck on imports
DSPy alternatives
| # | Agent | Pulse | Downloads 7d | 7d | 30d | VS Code installs | Stars | Latest release | Price | Last 90 days | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 4 |
LangChainLangChain |
77 | 44.3M | up 1.9% | down 22.0% | — | 147K+45/day | 1.4.38d ago | Free (OSS) | ||
| 10 |
LangGraphLangChain |
69 | 16.1M | up 11.4% | down 21.8% | — | 42.7K+48/day | 1.2.13yesterday | Free (OSS) | ||
| 11 |
AI SDKVercel |
67 | 34.5M | up 13.5% | up 20.9% | — | 27.1K+18/day | 6.0.301yesterday | Free (OSS) | ||
| 13 | 63 | 8.7M | up 0.6% | up 2.0% | — | 8,679+23/day | 1.58.0yesterday | Free (OSS) | |||
| 17 |
Claude Agent SDKAnthropic |
59 | 21.5M | up 14.6% | up 0.6% | — | 8,219+5/day | 0.2.1636d ago | Free (OSS) | ||
| 21 |
MastraMastra |
58 | 2.2M | up 11.1% | up 19.1% | — | 28.6K+27/day | 1.74.0yesterday | Free (OSS) | ||
| No agents match that filter. | |||||||||||
DSPy FAQ
How much does DSPy cost?
DSPy is open source and free to use; you pay only for the models and infrastructure it runs on.
Is DSPy open source?
Yes. DSPy is open source, released under the MIT license.
How popular is DSPy?
DSPy was downloaded 1.4M times from PyPI in the week ending Oct 4, 2026, up 4.8% on the week before and down 13.9% over the last 30 days compared with the 30 before. The GitHub repository has 38.5K stars, 763 of them added in the last 30 days. The latest stable release is 3.4.0, published Sep 25, 2026; there were 1 stable releases in the past 30 days.
What is the latest version of DSPy?
The latest stable release we track is 3.4.0, published on Sep 25, 2026.
What are the alternatives to DSPy?
The closest alternatives in the same category by Pulse Score are LangChain, LangGraph, AI SDK, Strands Agents.
Where these numbers come from
PyPI: dspy. GitHub: stanfordnlp/dspy. See data sources for how each one is collected.
