Skip to main content

Drop-in Anthropic & OpenAI Python SDK clients for BlockRun — genuine native passthrough (real signatures, system_fingerprint, native structure) with x402 USDC micropayments on Base or Solana. No model substitution, no response reshaping.

Project description

blockrun-llm-vip

Genuine native passthrough for Anthropic and OpenAI through the BlockRun gateway — pay per call in USDC (x402) on Base or Solana, with zero model substitution and zero response reshaping.

Unlike a normal aggregator, these clients subclass the official anthropic and openai Python SDKs and only swap the transport (to add x402 payment) and the base URL. The gateway returns the upstream provider's response verbatim, so the official SDK parses the real signals:

  • Claude: real thinking-block signature, native content[] (text / thinking / tool_use), usage.cache_creation_input_tokens / cache_read_input_tokens, native signature_delta streaming — routed to Anthropic's native /v1/messages.
  • GPT: native id (chatcmpl-*), system_fingerprint, usage.*_tokens_details, honest response_format (JSON mode) + stop + nested errors. gpt-4o / gpt-4o-mini are served OpenAI-direct.

A Claude / OpenAI relay detector (e.g. cctest.ai) sees a direct upstream call.

Install

pip install blockrun-llm-vip

Use — it's a drop-in

from blockrun_llm_vip import Anthropic, OpenAI

# Claude — exactly the official anthropic SDK API
claude = Anthropic()                      # wallet auto-loaded from ~/.blockrun/.session
r = claude.messages.create(
    model="claude-sonnet-4.6",
    max_tokens=2048,
    thinking={"type": "enabled", "budget_tokens": 1024},
    messages=[{"role": "user", "content": "What is 23*47?"}],
)
for block in r.content:
    if block.type == "thinking":
        print("signature:", block.signature)   # real Anthropic signature

# GPT — exactly the official openai SDK API
gpt = OpenAI()
r = gpt.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "hi"}],
)
print(r.system_fingerprint, r.model)        # genuine OpenAI direct

Async: from blockrun_llm_vip import AsyncAnthropic, AsyncOpenAI.

Solana — pay in USDC on Solana

Pass chain="solana" to any client to pay USDC on Solana (routed through sol.blockrun.ai) instead of Base. The response is identical native passthrough — only the payment leg changes (x402 SVM signing instead of EIP-712). Needs the [solana] extra:

pip install blockrun-llm-vip[solana]
from blockrun_llm_vip import Anthropic, OpenAI, Video

claude = Anthropic(chain="solana")   # bs58 key auto-loaded from ~/.blockrun/.solana-session
gpt    = OpenAI(chain="solana")
video  = Video(chain="solana")
# default stays Base:
claude_base = Anthropic()

Works on all clients (Anthropic, OpenAI, Video, RealFace, VirtualPortrait

  • async). Signing needs a Solana RPC for the blockhash — it defaults to BlockRun's free proxy and is overridable via rpc_url= or the SOLANA_RPC_URL env var.

Video — Seedance, incl. real-person (RealFace)

Generate short videos through the gateway with ByteDance Seedance. Video.generate() runs the async submit→poll loop for you (x402-paid both legs by the same wallet) and returns the gateway's verbatim completed-job JSON — data[0].url is a permanent BlockRun-hosted MP4. Defaults to bytedance/seedance-2.0-fast.

from blockrun_llm_vip import Video

video = Video()
job = video.generate(
    "a neon-lit cyberpunk street, slow dolly forward",
    duration_seconds=5,
    aspect_ratio="16:9",
)
print(job["data"][0]["url"])          # permanent MP4 URL

Real people are supported. A specific, real human can appear consistently across clips — you don't upload a face per call (raw face uploads to Sora / generic image-to-video are blocked by design). Instead you enroll the person once via RealFace (one-time $0.01, ~1-min on-phone liveness for consent, no KYC), get a ta_xxxx, and pass it as real_face_asset_id on Seedance 2.0 / 2.0-fast:

Subject Use Liveness KYC Enroll
A real, specific person RealFace ~1 min on phone (consent) No init → liveness → enroll
AI character / mascot VirtualPortrait None No single enroll call

Full flow, state machine, and error states: docs/real-person-flow.md.

from blockrun_llm_vip import Video, RealFace

rf = RealFace()
started = rf.init("Spokesperson — Q3 campaign")
print("Open on the rights-holder's phone:", started["h5_link"])   # QR / mobile link
rf.wait_until_active(started["group_id"])                         # after they nod + blink
asset = rf.enroll(
    name="Spokesperson — Q3 campaign",
    image_url="https://example.com/person.jpg",
    group_id=started["group_id"],
)

video = Video()
job = video.generate(
    "she smiles warmly and waves at the camera in soft studio light",
    model="bytedance/seedance-2.0",
    real_face_asset_id=asset["asset_id"],   # ta_xxxx
)
print(job["data"][0]["url"], job["payment"]["tx_hash"])

real_face_asset_id is mutually exclusive with image_url and only works on Seedance 2.0 / 2.0-fast. Other generate() options: resolution, generate_audio, seed, watermark, return_last_frame, plus timeout / poll_interval for the poll loop.

AI character (mascot / avatar, no liveness) — enroll a Virtual Portrait instead of a RealFace; same ta_xxxxreal_face_asset_id flow:

from blockrun_llm_vip import VirtualPortrait

vp = VirtualPortrait()
asset = vp.enroll(name="Mascot", image_url="https://example.com/character.jpg")  # $0.01
# pass asset["asset_id"] as real_face_asset_id on Seedance 2.0 / 2.0-fast

List what a wallet has enrolled: RealFace().list() / VirtualPortrait().list() (free). Async: AsyncVideo, AsyncRealFace, AsyncVirtualPortrait.

Wallet

The private key is used only for local signing (EIP-712 on Base, SVM on Solana) and never leaves your machine.

  • Base: private_key= arg → BLOCKRUN_WALLET_KEY env → BASE_CHAIN_WALLET_KEY env → ~/.blockrun/.session.
  • Solana (chain="solana"): private_key= arg (bs58) → SOLANA_WALLET_KEY env → ~/.*/solana-wallet.json~/.blockrun/.solana-session.

Access

Give BlockRun your wallet address to enable VIP, then pay per call from that wallet.

Contact: vicky@blockrun.ai

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

blockrun_llm_vip-0.3.0.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

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

blockrun_llm_vip-0.3.0-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file blockrun_llm_vip-0.3.0.tar.gz.

File metadata

  • Download URL: blockrun_llm_vip-0.3.0.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for blockrun_llm_vip-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cda57fbd3cd6e64d1c9d4deddc9c5cefd85aecd46652cd8e0b3a3eef813da342
MD5 00816d623518d6a01a4c97c75a6ffdb7
BLAKE2b-256 5b855204a232e28720fb9cdb48d41558a4153ec97af5f14c4edd859c476851c9

See more details on using hashes here.

File details

Details for the file blockrun_llm_vip-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for blockrun_llm_vip-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b2de120ca9a8d35f1c04a05dbc4ce5b8826d5eb6d8a964e82ecdfd2c92d35011
MD5 b626340cc5c3990515628414c9d2d8aa
BLAKE2b-256 a86ab59f0ffe3110dbf86e60c07a865751dfc531fec462720900111e977a96e3

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