Pay with AI3 Now Available in the Auto SDK
Earlier this month we announced Pay with AI3 - the ability to purchase Auto Drive storage credits directly with AI3, no intermediary required. Today we’re taking the next step: full Pay with AI3 support is now available in the Auto SDK, starting with @autonomys/auto-drive v1.6.10.
If you’re building an application on Auto Drive, you can now give your users a complete storage purchasing flow without hand-rolling any of the payment API calls yourself. Everything you need - price lookups, payment intents, transaction watching, and completion polling - is a single import away.
What’s in the Box
Six new methods on the AutoDriveApi object cover the entire purchasing lifecycle:
import { createAutoDriveApi } from '@autonomys/auto-drive'
import { NetworkId } from '@autonomys/auto-utils'
// Public instance (no API key) - safe for browser-side price display
const publicApi = createAutoDriveApi({ apiKey: null, network: NetworkId.MAINNET })
// Show users the current storage price before they connect a wallet
const { ai3PerGb } = await publicApi.getStoragePrice()
// Fetch live contract details - no hardcoded addresses or ABIs
const { chainId, contractAddress, payIntentAbi } = await publicApi.getPaymentContractInfo()
For the authenticated flow (server-side, with an API key):
const api = createAutoDriveApi({
apiKey: process.env.AUTO_DRIVE_API_KEY!,
network: NetworkId.MAINNET,
})
// 1. Lock in the current price for 10 minutes
const intent = await api.createPaymentIntent(contentSizeBytes)
// 2. Your app sends the on-chain tx (using viem, wagmi, ethers - your choice)
// 3. Tell Auto Drive about the transaction
await api.watchPaymentTransaction(intent.intentId, txHash)
// 4. Wait for credits to land
const result = await api.waitForPaymentCompletion(intent.intentId)
if (result === 'COMPLETED') {
// Credits are live - upload as normal
}
Once credits are confirmed, uploads work exactly as before. No special flags, no new upload API. Your existing uploadFile/uploadFileFromBuffer calls just work.
The Autonomys Developer Hub covers two integration patterns in detail: your app can hold a funded wallet and purchase credits on behalf of users, or you can direct users to purchase their own credits under their own Auto Drive identity. The right approach depends on your use case - see the developer integration guide for both patterns with code examples.
From Eulonomys to the SDK
Some of you may have seen Eulonomys, the open-source reference app we built to prove out Pay with AI3 end-to-end (GitHub, docs). Eulonomys shipped with a custom AutoDrivePaymentService that handled intent creation, transaction watching, status polling, and price conversions manually.
That code has now been absorbed into the SDK as first-class methods. If you were referencing Eulonomys as a pattern, you can replace all of that with four SDK calls: createPaymentIntent, watchPaymentTransaction, getPaymentIntentStatus, and waitForPaymentCompletion. Two additional methods - getStoragePrice and getPaymentContractInfo - are new capabilities that weren’t in Eulonomys at all, giving you live price estimates and contract details without hardcoding anything.
On-Chain Details
The on-chain transaction itself remains the developer’s responsibility. The SDK handles everything on the Auto Drive API side; you bring your preferred wallet library for the payIntent(bytes32) contract call on Auto EVM.
A few things worth noting:
- Chain ID 870 (Autonomys Auto EVM mainnet). Use
getPaymentContractInfo()for the contract address and ABI rather than hardcoding them. - Auto EVM does not support EIP-1559 fee history. Use a legacy (type-0) transaction with a small gas price buffer:
gasPrice = await publicClient.getGasPrice() + parseGwei('1'). - The intent window is currently 10 minutes. If the on-chain tx isn’t submitted and watched within that window, the intent expires and must be recreated. This window is adjustable - if it causes friction in your integration, let us know. We’d rather tune it based on real developer feedback than guess.
The SDK README includes complete examples for both viem and wagmi if you want copy-paste starting points.
No Breaking Changes
v1.6.10 is purely additive. All payment methods are new exports. Your existing upload, download, and read calls are completely unaffected. There are no new peer dependencies - @autonomys/auto-utils, which was already required, provides the internal utilities.
Developer Documentation
Full developer documentation for Pay with AI3 is now live:
- Pay with AI3 - Developer Integration - payment intent architecture, smart contract reference, state machine, API reference, and two integration patterns with code examples
- Available Functions - all 27 Auto Drive SDK functions with full type definitions, including the six new Pay with AI3 methods
- Eulonomys - Reference App - working implementation with source code showing the payment flow end-to-end
If you’re new to Auto Drive, start with the Overview & Setup and the end-user Pay with AI3 guide.
Get Started
- Update to the latest SDK:
npm install @autonomys/auto-drive@latest - Sign up at ai3.storage if you haven’t already - the free tier is available immediately
- Read the full introduction to Pay with AI3 for the broader context
- Check out the Pay with AI3 section of the developer docs
- Check out Eulonomys on GitHub for a working reference implementation
If you’re building something and have questions, come find us on Discord. We want to hear about what you’ve got cooking.
