NeuForge Pay for LangChain (neuforge-langchain)
A LangChain callback handler that natively implements the Bounded Overshoot x402 token metering protocol.
⚠️ Pricing & Metering Disclosure This SDK requires an active API key from neuforge.app. It acts as a cloud-metered gateway that tracks your LLM token usage and synchronizes it synchronously with the NeuForge backend via HTTP.
Important: If your NeuForge account balance drops below zero or your budget is exceeded, this SDK will intentionally halt your execution by throwing an
HTTP 402 Payment Requiredexception. You must manage your billing on neuforge.app to ensure uninterrupted service.
Usage
from neuforge_langchain import NeuForgeCallbackHandler
from langchain_openai import ChatOpenAI
# Initialize with your API Key from neuforge.app
handler = NeuForgeCallbackHandler(api_key="nf_live_your_api_key_here")
llm = ChatOpenAI(callbacks=[handler])
# This generation will hit the NeuForge cloud backend to sync token usage.
# If your account runs out of budget, a PaymentRequiredException is thrown!
response = llm.invoke("Write a very long story.")
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neuforge_langchain-1.0.1.tar.gz.
File metadata
- Download URL: neuforge_langchain-1.0.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1668140f71cff44104dc252f89b611d1df2c0cd776e3368dab9a4546787a26d8
|
|
| MD5 |
e8812360542363e0ec6805f1207ed5b1
|
|
| BLAKE2b-256 |
163633624817ff2bfd912c2b25928dd67ef8f9cafcfcae3136471d8a348b6059
|
File details
Details for the file neuforge_langchain-1.0.1-py3-none-any.whl.
File metadata
- Download URL: neuforge_langchain-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4663143bad984b701386eac97b6d208e3ac7a51662e8913a95e1380dd0c5d507
|
|
| MD5 |
96eb51f5496f6b2f3911696c45b92c7e
|
|
| BLAKE2b-256 |
0a8fede91869d93b1b415bcdba08f1891cb17a94ffc3018bb8063309bf50995e
|