Skip to main content

langchain-llm-prices

Know what your LangChain app spends, for every provider, and stop an agent before it spends too much. Prices come from llm-prices: dated, source-cited list prices for Anthropic, OpenAI, Google (AI Studio and Vertex), Bedrock, Azure, DeepSeek, Mistral, Groq, Together, Fireworks, xAI, Cohere and OpenRouter, with prompt cache reads and writes at their own rates.

pip install -U langchain-llm-prices

get_cost_callback(): get_openai_callback, but for every provider.

from langchain.chat_models import init_chat_model
from langchain_llm_prices import get_cost_callback

with get_cost_callback() as cb:
    init_chat_model("anthropic:claude-sonnet-4-6").invoke("Tell me a joke")
    init_chat_model("google_genai:gemini-2.5-flash").invoke("Tell me a joke")
print(cb.total_cost, cb.cost_by_model)

CostCapMiddleware: a dollar budget for create_agent, per run and per thread.

from langchain.agents import create_agent
from langchain_llm_prices import CostCapMiddleware

agent = create_agent(
    "anthropic:claude-sonnet-4-6",
    tools=[...],
    middleware=[CostCapMiddleware(max_usd_per_run=0.50, max_usd_per_thread=5.00)],
)

Models with no listed price (local models, private deployments) are reported as unpriced, never counted as $0 without telling you.

Docs: https://github.com/Mattbusel/langchain-llm-prices/blob/main/docs/index.md

Metadata

Release files for langchain-llm-prices 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-llm-prices 0.1.0
File Size Uploaded Provenance Actions
langchain_llm_prices-0.1.0.tar.gz 15.5 kB With provenance Details for langchain_llm_prices-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-llm-prices 0.1.0
File Interpreter ABI Platform Actions
langchain_llm_prices-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_llm_prices-0.1.0-py3-none-any.whl

Total release size: 26.7 kB

Release files / langchain_llm_prices-0.1.0.tar.gz

Download URL langchain_llm_prices-0.1.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
53624a7da0e836f8e057979207de372b01ff9fb4071363fbfa253f3597b28a99
BLAKE2b-256 checksum
How to use checksums
b79e2ebc5252c48961f413194798aae3e2a6b2e3d3692fd7feb667895e0967de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / langchain_llm_prices-0.1.0-py3-none-any.whl

Download URL langchain_llm_prices-0.1.0-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09afa2c10321498fabe7ddd44a1c8b5ed7ed5d86bdef0f568140313660b9e87f
BLAKE2b-256 checksum
How to use checksums
a26b94db59f3be204151b6feee523b17045d50d8666ad108398fd09869b72c21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for langchain-llm-prices 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_llm_prices-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page