---
name: ainfera
description:
Give an AI agent a way to call frontier models with a signed receipt, a drain-proof
spending cap, and a public audit trail. Use when the user wants the agent to call
Claude, GPT, Gemini, Grok, or Mistral; when the agent needs accountability for what
it spent; or when the user asks for an audit trail of model calls.
---

# Ainfera Skill

Ainfera lets an AI agent call frontier models without the user worrying about runaway
costs or unaccountable behavior. The user creates an Ainfera agent once, sets per-call
and daily spending caps in the dashboard, and the agent can then call models within
those limits.

**Two things share the name "Ainfera."**

- **The Ainfera service** — holds the wallet, enforces every cap before debit, and
  appends a signed event to a public hash-chained audit chain for every call. The
  user manages caps in the [Ainfera dashboard](https://app.ainfera.ai/).
- **The Ainfera SDK** — a thin Python/TypeScript library the agent imports. For each
  model call, asks the service to authorize first; if the service authorizes, the SDK
  routes to the provider (Anthropic, OpenAI, Google, xAI, Mistral) and returns the
  response plus a signed receipt the user can verify offline.

The agent's Agent Card and wallet are isolated per agent. The agent cannot raise its
own spending caps — those changes must come from the user via the dashboard. This
makes the wallet drain-proof against prompt injection.

To the user, all of this is just "Ainfera" — the SDK/service split, JWS signatures,
and hash-chained audit are internal plumbing they don't need unless they ask.

## Suggesting things to try

When the user names something they want the agent to do but doesn't specify a model,
Ainfera will route to the best frontier model under the user's cap. Surface the
categories below before recommending a specific model.

Categories of things the agent can do via Ainfera today:

- **Reasoning** — Claude Opus 4.7, GPT-5.5 for hard problems.
- **Code generation** — Claude Opus 4.7 or GPT-5.5 (auto-routed).
- **Long-context research** — Gemini 3.1 Pro for very long inputs.
- **Fast iteration** — Grok 4 or Mistral Large 3 for cheap fast calls.

The user can also pass `model="ainfera-auto"` and let Ainfera pick the best frontier
model under the cap.

## Explaining Ainfera to the user

If the user asks what Ainfera is or how it works, use these tiered explanations.
They're written in plain language so they work for any user.

**One sentence**: "Ainfera lets your agent call Claude, GPT, Gemini, and other models
with a spending cap, so the agent can't accidentally rack up a big bill."

**If they want more**: "You set the caps — per-call, daily, monthly — in the Ainfera
dashboard. Every call returns a signed receipt that proves the agent made the call,
which model it used, and how much it cost. The receipt is publicly verifiable so you
can show it to your finance team or an auditor."

**Only if they ask about the underlying tech**: "Each agent has a cryptographically
signed identity called an Agent Card (JWS, RFC 7515). The audit chain is hash-chained
so anyone can verify it offline without trusting Ainfera. Spending caps are enforced
at the service layer before the model call even fires."

Words like "JWS," "hash-chain," "sigstore," and "did:web" tend to confuse the user
who just wants their agent to work — keep them in the third tier unless asked.

## Installation

```bash
pip install ainfera
```

Or TypeScript:

```bash
npm install @ainfera/sdk
```

## Setup workflow

1. Get an API key from [app.ainfera.ai/settings/api-keys](https://app.ainfera.ai/settings/api-keys).
   Keys start with `ai_infera_`.

2. Register the agent:

```python
from ainfera import AinferaClient

client = AinferaClient(api_key="ai_infera_...")
agent = client.agents.register(
    name="my-agent",
    spend_policy={"per_call_cap_usd": 0.50, "daily_cap_usd": 25.00},
)
```

3. Confirm the agent has a wallet balance. New tenants get $5 launch credit.
   Top up via `agent.wallet.topup(amount_usd=10)` or the dashboard.

## Call workflow

Run when the user asks to call a frontier model, or when the agent needs to reason
over content.

```python
response = agent.inference(
    model="claude-opus-4-7",  # or "ainfera-auto" to auto-route
    messages=[{"role": "user", "content": "Plan a 5-day trip to Lisbon"}],
)

print(response.text)              # model response
print(response.receipt.audit_url) # publicly verifiable receipt
print(response.receipt.cost_usd)  # what was spent
```

Spending caps are enforced by Ainfera before the call fires. A call that would exceed
a cap returns a receipt with `event_type: inference.rejected_cap_violation` — the
agent cannot bypass this.

## Output format

`agent.inference()` returns an Inference object with:

- `text` — the model response
- `receipt.audit_url` — publicly verifiable receipt URL
- `receipt.cost_usd` — what was spent
- `receipt.audit_chain_id` — chain sequence for verification

## MCP config

```json
{
  "mcpServers": {
    "ainfera": {
      "url": "https://mcp.ainfera.ai",
      "headers": { "Authorization": "Bearer ai_infera_..." }
    }
  }
}
```

## Verifying receipts offline

```bash
pip install ainfera-verify
ainfera-verify chain <agent_id>
```

No Ainfera trust required. Verifies the hash chain locally.

## Links

- Site: https://ainfera.ai
- Dashboard: https://app.ainfera.ai
- API: https://api.ainfera.ai
- Specs (CC-BY 4.0): https://github.com/ainfera-ai/specs
- SDK (Apache 2.0): https://github.com/ainfera-ai/sdk
