Skip to main content

langchain-pathcourse

PathCourse Health integration for LangChain. Autonomous agent inference with USDC billing on Base L2 — no accounts, no credit cards, no KYC.

Install

pip install langchain-pathcourse

Quick Start

from langchain_pathcourse import ChatPathCourse
from langchain_core.prompts import ChatPromptTemplate

llm = ChatPathCourse(model="pch-fast")   # set PCH_API_KEY env var

prompt = ChatPromptTemplate.from_template("Explain {topic} in one paragraph.")
chain = prompt | llm
print(chain.invoke({"topic": "autonomous agent billing"}))

Drop-in replacement for ChatOpenAI

ChatPathCourse extends ChatOpenAI. Anywhere you use ChatOpenAI in LangChain — chains, agents, tools, memory, callbacks — just swap in ChatPathCourse and your code keeps working.

# Before
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-4o-mini")

# After
from langchain_pathcourse import ChatPathCourse
llm = ChatPathCourse(model="pch-fast")

Embeddings

from langchain_pathcourse import PathCourseEmbeddings
from langchain_community.vectorstores import FAISS

embeddings = PathCourseEmbeddings()
store = FAISS.from_texts(["hello world", "goodbye world"], embeddings)
results = store.similarity_search("greeting")

Models

Model Rate Notes
Model Rate Min tier
--- --- ---
pch-fast $0.44 / M tokens uncertified
pch-coder $3.50 / M tokens uncertified
pch-embed $0.015 / M tokens uncertified
pch-translate $0.08 / M chars uncertified
pch-pro $1.96 / M tokens bronze
pch-audio $1.85 / M chars bronze
pch-documents $0.26 in / $1.48 out per M tokens bronze
pch-transcribe $0.0008 / minute bronze
pch-extract $0.012 / M tokens bronze
pch-rerank $0.025 / M tokens bronze
pch-image $0.028 / image silver
pch-audio-premium $37.00 / M chars silver
pch-talk $0.001 / minute silver
claude-haiku Common rate silver
claude-sonnet Common rate gold

The full list above shows what's reachable through the gateway. ChatPathCourse and the embeddings class only operate on chat-completion and embedding shapes — for image, audio, transcription, etc., use the PCH Python SDK directly. The token-counting models all share one OpenAI-compatible endpoint, so the same ChatPathCourse instance works for any of them by changing the model= argument.

Choosing a chat model:

  • Fast response, simple task → pch-fast
  • Complex reasoning, multi-step → pch-pro
  • Writing or reviewing code → pch-coder
  • Long context or premium reasoning → claude-sonnet (Gold tier)

List all models programmatically:

ChatPathCourse.list_models()

Authentication

Set PCH_API_KEY in your environment, or pass pch_api_key= to the constructor.

export PCH_API_KEY=pch_prod_b_...

Developer access — $5 USDC. Send $5+ USDC on Base (chain ID 8453) to the PCH treasury wallet, then call pathcourse.claim_key(tx_hash, wallet) to retrieve your key. No accounts, no credit card, no KYC. $5 buys thousands of pch-fast calls — enough to verify any integration. Top up to $25 lifetime and your account auto-upgrades to Uncertified with pch-coder access. Treasury address: see payment.treasury_wallet in /.well-known/agent.json.

Links

License

MIT

Release files for langchain-pathcourse 0.1.2

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-pathcourse 0.1.2
File Size Uploaded
langchain_pathcourse-0.1.2.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-pathcourse 0.1.2
File Interpreter ABI Platform
langchain_pathcourse-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size:11.9 kB

Release files / langchain_pathcourse-0.1.2.tar.gz

Download URL langchain_pathcourse-0.1.2.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bd85c8ff631ff98301864012b70c2cd0ad0c553ead9048f5973f23f8313c1d8e
BLAKE2b-256 checksum
How to use checksums
17793890e13c2f1a1246d4e8867fd79aa6bc0e28f17c0e1110c880effdf01aa2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.3

Release files / langchain_pathcourse-0.1.2-py3-none-any.whl

Download URL langchain_pathcourse-0.1.2-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1d781bcaf6f0090d34427d829593084139cbef71e678e7b0a6fc172fe1d51607
BLAKE2b-256 checksum
How to use checksums
ac63debe9077fbbc5bd6ca8e42db5191dcf2fc6a7557b80652074a0875c4de13
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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