Skip to main content

LangChain integration for JarvisClaw AI API (x402 USDC payments supported)

Project description

langchain-jarvisclaw

LangChain integration for JarvisClaw AI API — 40+ models, pay-per-request with USDC via x402.

Install

pip install langchain-jarvisclaw

Usage

Mode 1: API Key (pre-paid balance)

from langchain_jarvisclaw import ChatJarvisClaw

chat = ChatJarvisClaw(api_key="sk-...", model="gpt-5.4")
response = chat.invoke("Explain quantum computing in one sentence")
print(response.content)

Mode 2: x402 Wallet Payment (no account needed)

Pay per request with USDC on Base. No signup, no API key — just a wallet.

from langchain_jarvisclaw import ChatJarvisClaw

chat = ChatJarvisClaw(
    wallet_private_key="0x...",  # Your EVM wallet private key
    model="anthropic/claude-sonnet-4.6",
)
response = chat.invoke("Write a haiku about AI agents")
print(response.content)

Discover Models & Pricing (no auth)

from langchain_jarvisclaw import ChatJarvisClaw

# List all models with USD pricing
models = ChatJarvisClaw.list_models()
for m in models[:5]:
    print(f"{m['model']}: ${m['input_per_m_token_usd']}/M input tokens")

# Find free models to test quality
free = ChatJarvisClaw.free_models()
print(f"Free models: {[m['model'] for m in free['free']]}")

# Check platform health
health = ChatJarvisClaw.health()
print(f"Status: {health['status']}, Models: {health['data']['total_models']}")

Use with LangChain chains

from langchain_core.prompts import ChatPromptTemplate
from langchain_jarvisclaw import ChatJarvisClaw

chat = ChatJarvisClaw(api_key="sk-...", model="gpt-5.4")

prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a helpful coding assistant."),
    ("human", "{question}"),
])

chain = prompt | chat
response = chain.invoke({"question": "How do I reverse a linked list in Go?"})

Streaming

chat = ChatJarvisClaw(api_key="sk-...", model="gpt-5.4", streaming=True)

for chunk in chat.stream("Tell me a story"):
    print(chunk.content, end="", flush=True)

Supported Models

40+ models including:

  • OpenAI: gpt-5.5, gpt-5.4, gpt-5.4-mini, o3, o1
  • Anthropic: claude-opus-4.7, claude-sonnet-4.6, claude-haiku-4.5
  • Google: gemini-3.1-pro, gemini-2.5-flash
  • DeepSeek: deepseek-chat, deepseek-reasoner
  • And many more — call ChatJarvisClaw.list_models() for the full list

Payment Networks

  • Base (EVM): USDC on Base mainnet (default)
  • Solana: USDC on Solana (install with pip install langchain-jarvisclaw[solana])

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_jarvisclaw-0.1.0.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

langchain_jarvisclaw-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file langchain_jarvisclaw-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_jarvisclaw-0.1.0.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for langchain_jarvisclaw-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a7a4a9da027ec1b8c146db2e6e6225ce32c23505942bebe568081fa73d42190a
MD5 8a2c8fa4bacdb106edbc65fceb2b9fd0
BLAKE2b-256 19faaa5826a6aa8075c698dfdd68790336125ebf797a55c1a1e988ba5fd9626f

See more details on using hashes here.

File details

Details for the file langchain_jarvisclaw-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_jarvisclaw-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 918ada58ff681bc6a3c16a52110b3ee156191ac4210c4a213647d9926779d902
MD5 1c59ca010d5b676c8645ff8cecb865a3
BLAKE2b-256 6d6aeb3d7b12d9f10ac254dfd044fa24f0f12ec80ffedb5a1265631a30a6d9b3

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