Skip to content

ainfera-ai/sdk

ainfera — Python SDK for Ainfera

PyPI version Python versions CI License: Apache 2.0

Agent-native inference routing by Ainfera. Signed AgentCards, provider-neutral routing, hash-chained AuditChains — out of the box.

Install

pip install ainfera

Requires Python 3.10+.

Quickstart

from ainfera import AinferaClient

# api_key also reads from the AINFERA_API_KEY environment variable
client = AinferaClient(api_key="ak_...")
agent = client.agents.register(name="my-agent")
agent.wallet.topup(amount_usd=10)

response = agent.inference(
    model="claude-opus-4-7",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.text)
print(response.receipt.audit_url)

Signup bootstrap (from_signup)

One-shot registration returns an API key and Agent bundle — persist the key, then build a client:

from ainfera import AinferaClient

result = AinferaClient().agents.signup(
    agent_handle="my-bot",
    owner_handle="your-github-login",
)
client = AinferaClient.from_signup(result)
agent = client.agents.retrieve(result.agent_id)
entries = agent.ledger.entries(limit=20)

Ledger on Agent

Each agent exposes an append-only ledger handle backed by GET /v1/ledger/{agent_id}:

balance = agent.ledger.balance  # set after entries()
for entry in agent.ledger.entries(limit=50):
    print(entry.kind, entry.amount_usd)

What is Ainfera?

The Inference of AI Agents. Ainfera Inference (the flagship product — the routing brain) picks the best model under your agent's budget and latency caps. Point at ainfera-inference and trust the researched decision. One Agent Card across 50+ models. Every routing decision and inference call cryptographically audited. See ainfera.ai and the ainfera-routing decision library.

Features

  • Signed AgentCards per Agent (JWS, RFC 7515)
  • Provider-neutral routing across Anthropic, OpenAI, Together (more soon)
  • Atomic per-call settlement out of an Agent-scoped Wallet
  • Tamper-evident hash-chained AuditChain for every Agent
  • Local verification — auditors can verify a chain offline, no Ainfera trust required
  • Sync + async clients sharing one resource surface

Concepts

Compose, don't invent

This SDK is a thin wrapper around the Ainfera API. The underlying primitives align with — and link to — public standards work:

License

Apache 2.0. See LICENSE.

About

Agent-native inference routing by Ainfera. Python SDK — signed AgentCards, routed inference, audit chain.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages