Skip to main content

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 Required exception. 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

neuforge_langchain-1.0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuforge_langchain-1.0.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

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

Hashes for neuforge_langchain-1.0.1.tar.gz
Algorithm Hash digest
SHA256 1668140f71cff44104dc252f89b611d1df2c0cd776e3368dab9a4546787a26d8
MD5 e8812360542363e0ec6805f1207ed5b1
BLAKE2b-256 163633624817ff2bfd912c2b25928dd67ef8f9cafcfcae3136471d8a348b6059

See more details on using hashes here.

File details

Details for the file neuforge_langchain-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for neuforge_langchain-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4663143bad984b701386eac97b6d208e3ac7a51662e8913a95e1380dd0c5d507
MD5 96eb51f5496f6b2f3911696c45b92c7e
BLAKE2b-256 0a8fede91869d93b1b415bcdba08f1891cb17a94ffc3018bb8063309bf50995e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

1.0.0

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page