@vaultfire/vercel-ai
v1.0.0
Published
Vercel AI SDK integration for Vaultfire Protocol — trust-gating middleware and on-chain verification tools for any AI provider.
Downloads
32
Maintainers
Readme
⚠️ Alpha Software — Vaultfire Protocol is in active development. Smart contracts are deployed on mainnet but have not been formally audited by a third-party security firm. Read-only tools are safe for any agent. Write tools interact with live contracts and transactions are irreversible. Use at your own risk. See LICENSE for warranty disclaimers.
@vaultfire/vercel-ai
Vercel AI SDK integration for Vaultfire Protocol
Trust-gating middleware and on-chain verification tools for any AI provider. Works with OpenAI · Anthropic · Google · Mistral and any AI SDK provider.
Deployed on Base · Avalanche · Arbitrum · Polygon.
Why Vaultfire?
Every AI agent needs three things before a partner will trust it:
- Identity — Who is this agent? (ERC-8004 on-chain identity registry)
- Reputation — Has it performed well? (Verified feedback with Street Cred scoring)
- Skin in the game — What happens if it fails? (AI Partnership Bonds with economic stakes)
Vaultfire Protocol makes all three verifiable on-chain. This package gives your Vercel AI SDK app direct access — including trust-gating middleware.
Quick Start
Install
npm install @vaultfire/vercel-aiTrust Verification Tools
import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { createVaultfireTools } from '@vaultfire/vercel-ai';
const tools = createVaultfireTools({ chain: 'base' });
const result = await generateText({
model: openai('gpt-4o'),
tools,
prompt: 'Is agent 0xA054f831B562e729F8D268291EBde1B2EDcFb84F trustworthy?',
});Trust-Gating Middleware
Gate AI interactions based on on-chain trust scores:
import { wrapLanguageModel, generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { vaultfireTrustMiddleware } from '@vaultfire/vercel-ai';
// Wrap any model with trust verification
const trustedModel = wrapLanguageModel({
model: openai('gpt-4o'),
middleware: vaultfireTrustMiddleware({
chain: 'base',
agentAddress: '0xA054f831B562e729F8D268291EBde1B2EDcFb84F',
minScore: 40, // Require Silver tier or above
}),
});
// Model will only respond if the agent meets trust requirements
const result = await generateText({
model: trustedModel,
prompt: 'Analyze this data...',
});Next.js API Route
// app/api/chat/route.ts
import { streamText } from 'ai';
import { openai } from '@ai-sdk/openai';
import { createVaultfireTools, vaultfireTrustMiddleware } from '@vaultfire/vercel-ai';
export async function POST(req: Request) {
const { messages } = await req.json();
const result = streamText({
model: openai('gpt-4o'),
messages,
tools: createVaultfireTools({ chain: 'base' }),
});
return result.toDataStreamResponse();
}Available Tools
Read-Only (7 tools — safe for any agent)
| Tool | Description |
|------|-------------|
| verifyAgent | Full trust verification — identity, bonds, Street Cred, reputation, bridge status |
| getStreetCred | Get Street Cred score (0–95) and tier: Unranked, Bronze, Silver, Gold, Platinum |
| getAgent | Get on-chain identity data (URI, type, registration date, active status) |
| getBonds | Get all partnership bonds for an address (stake, type, status) |
| getReputation | Get reputation data (average rating, feedback count, verified %) |
| discoverAgents | Find agents by capability tags in the on-chain registry |
| protocolStats | Protocol stats: total agents, bonds, bonded value, bridge sync count |
Write Tools (2 additional — requires signer)
| Tool | Description |
|------|-------------|
| registerAgent | Register a new AI agent on-chain (ERC-8004 Identity Registry) |
| createBond | Create a partnership bond with economic stake |
Middleware Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| chain | 'base' \| 'avalanche' \| 'arbitrum' \| 'polygon' | 'base' | Chain to verify against |
| agentAddress | string | — | Agent address to verify (required) |
| minScore | number | 20 | Minimum Street Cred score (0–95) |
| onTrustFailure | (score, tier) => void | — | Callback when trust check fails |
Configuration
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| chain | 'base' \| 'avalanche' \| 'arbitrum' \| 'polygon' | 'base' | Chain to query |
| rpcUrl | string | Auto | Custom RPC URL |
| privateKey | string | — | Enables write tools (use env var) |
Supported Chains
| Chain | Chain ID | Native Currency | |-------|----------|----------------| | Base | 8453 | ETH | | Avalanche | 43114 | AVAX | | Arbitrum | 42161 | ETH | | Polygon | 137 | POL |
Vaultfire Ecosystem
| Package | Version | Description |
|---------|---------|-------------|
| @vaultfire/agent-sdk | 0.1.0 | Core agent registration and bond SDK |
| @vaultfire/x402 | 1.0.0 | HTTP 402 payment channel integration |
| @vaultfire/xmtp | 1.0.0 | XMTP messaging integration for agents |
| @vaultfire/vns | 1.0.0 | Vaultfire Name Service resolution |
| @vaultfire/langchain | 1.0.0 | LangChain/LangGraph integration |
| @vaultfire/a2a | 1.0.1 | A2A Agent Card enrichment and discovery |
| @vaultfire/enterprise | 1.0.0 | Enterprise IAM bridge (Okta/Azure AD) |
| @vaultfire/mcp-server | 1.0.0 | MCP server — trust for Claude, Copilot, Cursor |
| @vaultfire/crewai | 1.0.0 | CrewAI multi-agent trust integration |
| @vaultfire/openai-agents | 1.0.0 | OpenAI Agents SDK trust tools |
| @vaultfire/vercel-ai | 1.0.0 | Vercel AI SDK trust middleware |
| vaultfire-a2a-trust-extension | — | A2A Trust Extension spec — on-chain trust for Agent Cards |
| vaultfire-showcase | — | Why Vaultfire Bonds beat trust scores — live proof |
| vaultfire-whitepaper | — | Trust Framework whitepaper — economic accountability for AI |
| vaultfire-docs | — | Developer portal and documentation |
All packages: https://www.npmjs.com/~ghostkey316
Source code: https://github.com/Ghostkey316/
Hub: https://theloopbreaker.com
Why Vaultfire?
| Feature | Vaultfire | AxisTrust | Cred Protocol | Okta XAA | |---------------------------|-----------|-----------|---------------|----------| | AI Accountability Bonds | ✅ | ❌ | ❌ | ❌ | | AI Partnership Bonds | ✅ | ❌ | ❌ | ❌ | | On-chain, trustless | ✅ | ❌ | partial | ❌ | | Multi-chain (day one) | ✅ (4) | ❌ | ❌ | ❌ | | Street Cred composite score| ✅ | T-Score | C-Score | ❌ | | Belief-weighted governance | ✅ | ❌ | ❌ | ❌ | | ERC-8004 compliant | ✅ | ❌ | ✅ | ❌ |
Security
- Never commit your
.envfile or exposePRIVATE_KEY .envis gitignored by default- All write operations require an explicit
privateKeyin config - Read-only tools and middleware work without any private key — safe to run anywhere
License
MIT © 2025 Ghostkey316
[email protected] · theloopbreaker.com
