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_...
Get an API key at pathcoursehealth.com.
Links
- Platform: pathcoursehealth.com
- Python SDK: pypi.org/project/pathcourse-sdk
- JS SDK: npmjs.com/package/@pathcourse/sdk
- Integration examples: github.com/pathcourse-health/pch-integration-examples
License
MIT
Project details
Release history Release notifications | RSS feed
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 langchain_pathcourse-0.1.1.tar.gz.
File metadata
- Download URL: langchain_pathcourse-0.1.1.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d11f3a07fab7a4e50709eec6edc7762ec24c7c8b2d6bbae5ce03fd2f0db3b9d9
|
|
| MD5 |
5b310918285185f8030ce6a2d817ac32
|
|
| BLAKE2b-256 |
5f67299e633e275e90ee907e236f0abafc3bc2afecae8b53fb1e4582f52bf9d4
|
File details
Details for the file langchain_pathcourse-0.1.1-py3-none-any.whl.
File metadata
- Download URL: langchain_pathcourse-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7fa5ece3a4ea8fd3ce76c569ca26a642213d69ba5845428e067be3852ecdfb7
|
|
| MD5 |
5c19c5b3985ad31cebec42349f2f84d1
|
|
| BLAKE2b-256 |
bb5708b82c51666a8c376c7c11ec36241321787fe1f2d935f05d221cbc84819b
|