Skip to main content

LangChain integration for PathCourse Health — autonomous agent inference with USDC billing on Base L2

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_pathcourse-0.1.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

langchain_pathcourse-0.1.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file langchain_pathcourse-0.1.2.tar.gz.

File metadata

  • Download URL: langchain_pathcourse-0.1.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for langchain_pathcourse-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bd85c8ff631ff98301864012b70c2cd0ad0c553ead9048f5973f23f8313c1d8e
MD5 11fa601a7d56fe2d5b8985ba84bc7ac4
BLAKE2b-256 17793890e13c2f1a1246d4e8867fd79aa6bc0e28f17c0e1110c880effdf01aa2

See more details on using hashes here.

File details

Details for the file langchain_pathcourse-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_pathcourse-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d781bcaf6f0090d34427d829593084139cbef71e678e7b0a6fc172fe1d51607
MD5 97e85eee683fc60d34733583cb10bd61
BLAKE2b-256 ac63debe9077fbbc5bd6ca8e42db5191dcf2fc6a7557b80652074a0875c4de13

See more details on using hashes here.

Supported by

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