Pydantic AI integration for PathCourse Health — typed agents with autonomous USDC billing on Base L2
Project description
pydantic-ai-pathcourse
Pydantic AI integration for PathCourse Health. Build typed, production-grade agents with autonomous USDC billing on Base L2 — no accounts, no credit cards, no KYC.
Install
pip install pydantic-ai-pathcourse
Quick Start
from pydantic_ai import Agent
from pydantic_ai_pathcourse import PathCourseModel
agent = Agent(
model=PathCourseModel("pch-pro"),
system_prompt="You are an expert in autonomous agent infrastructure.",
)
result = agent.run_sync("What is Path Score?")
print(result.data)
Structured output
Pydantic AI's structured-output guarantees work unchanged with PCH:
from pydantic import BaseModel
from pydantic_ai import Agent
from pydantic_ai_pathcourse import PathCourseModel
class InfraReport(BaseModel):
summary: str
requirements: list[str]
risk_level: int
agent = Agent(
model=PathCourseModel("pch-pro"),
result_type=InfraReport,
)
result = agent.run_sync("Analyze autonomous agent infrastructure for a fintech startup.")
print(result.data.requirements)
Tool use
from pydantic_ai import Agent, RunContext
from pydantic_ai_pathcourse import PathCourseModel
agent = Agent(model=PathCourseModel("pch-pro"))
@agent.tool
async def get_balance(ctx: RunContext[None], agent_id: str) -> float:
"""Look up the USDC balance for a PCH agent."""
return 42.50
result = agent.run_sync("What is the balance for agent abc123?")
Models
| Model | Rate | Min tier | Notes |
|---|---|---|---|
pch-fast |
$0.44 / M tokens | uncertified | Fast reasoning, classification, routing |
pch-coder |
$3.50 / M tokens | uncertified | Code generation, debugging |
pch-embed |
$0.015 / M tokens | uncertified | Text embeddings for semantic search / RAG |
pch-translate |
$0.08 / M chars | uncertified | Multilingual translation |
pch-pro |
$1.96 / M tokens | bronze | Deep reasoning, multi-step planning |
pch-audio |
$1.85 / M chars | bronze | Text-to-speech, standard quality |
pch-documents |
$0.26 in / $1.48 out per M tokens | bronze | Document parsing / OCR |
pch-transcribe |
$0.0008 / minute | bronze | Speech-to-text |
pch-extract |
$0.012 / M tokens | bronze | Structured data extraction |
pch-rerank |
$0.025 / M tokens | bronze | Reranking for RAG pipelines |
pch-image |
$0.028 / image | silver | Text-to-image |
pch-audio-premium |
$37.00 / M chars | silver | Text-to-speech, premium quality |
pch-talk |
$0.001 / minute | silver | Voice conversation |
claude-haiku |
Common rate | silver | Anthropic Claude Haiku |
claude-sonnet |
Common rate | gold | Anthropic Claude Sonnet |
PathCourseModel only operates on chat-completion shapes — for image/audio/transcription, use the PCH Python SDK directly.
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)
Authentication
Set PCH_API_KEY in your environment, or pass pch_api_key= to PathCourseModel.
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 typed-agent 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
- Platform: pathcoursehealth.com
- Pydantic AI: ai.pydantic.dev
- Python SDK: pypi.org/project/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 pydantic_ai_pathcourse-0.1.2.tar.gz.
File metadata
- Download URL: pydantic_ai_pathcourse-0.1.2.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3517bf0d0ba315378a22a0a8a616280fd1b0cff7976803a54b93995040a3ca8
|
|
| MD5 |
8199d92c01aaa3d178e3c8bc31155f54
|
|
| BLAKE2b-256 |
282393247c6f674a6ef603e99e04ebd9928c4f928b631985838dc495b6c68a68
|
File details
Details for the file pydantic_ai_pathcourse-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pydantic_ai_pathcourse-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.0 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 |
a042ea94ef89657d90707a6dd047b58c823c14cc4f05ccda2c39c4e05f07ccf0
|
|
| MD5 |
4cf1eb807a769d4b6fdba27e63e5e476
|
|
| BLAKE2b-256 |
30449cff2ce8475a89bef2bba448a1a3ac2c16916492918516b2538ce2b54ff4
|