@amillisats/sdk
v1.0.1
Published
The official AMILLISATS SDK for Bitcoin-native marketplace transactions
Downloads
121
Maintainers
Readme
@amillisats/sdk
The official SDK for AMILLISATS — a Bitcoin-native pay-per-use AI marketplace, settled via the Lightning Network.
Install
npm install @amillisats/sdkQuick Start
import { AmilliSats } from '@amillisats/sdk'
const client = new AmilliSats({ apiKey: 'ams_your_api_key' })
// Get available task types
const taskTypes = await client.getTaskTypes()
// Get a quote
const quote = await client.getQuote({
task_type_id: taskTypes[0].id,
description: 'Write a blog post about Bitcoin Lightning Network',
answers: { 0: 'Developers', 1: 'Technical', 2: '1000 words' }
})
// quote.sats: 17094, quote.usd: "10.05", quote.complexity: "simple"
// Submit task (returns Lightning invoice URL)
const result = await client.submitTask({
task_type_id: taskTypes[0].id,
description: 'Write a blog post about Bitcoin Lightning Network',
answers: { 0: 'Developers', 1: 'Technical', 2: '1000 words' },
quoted_sats: quote.sats,
complexity: quote.complexity,
email: '[email protected]'
})
// result.invoice_url: BTCPay checkout URL
// result.task.id: task ID to check status
// Check task status
const task = await client.getTask(result.task.id)
// task.status: 'pending_payment' | 'paid' | 'generating' | 'delivered' | 'failed'
// task.generated_content: the AI output (when delivered)Metered API (Pay per call)
// Create an API account
const account = await AmilliSats.createApiAccount({ email: '[email protected]' })
// account.api_key: 'ams_...'
// Generate content directly (deducts from sats balance)
const client = new AmilliSats({ apiKey: account.api_key })
const result = await client.generate({
task_type: 'blog-post',
prompt: 'Write about Bitcoin Lightning Network',
context: 'Audience: developers, tone: technical'
})
// result.content: generated text
// result.cost_sats: 17094
// result.remaining_balance_sats: 482906
// Check balance
const { account: acct } = await client.getApiAccount()
// acct.sats_balance: remaining satsBounties
const client = new AmilliSats()
// List open bounties
const bounties = await client.getBounties()
// Post a bounty
const bounty = await client.postBounty({
title: 'Best Python web scraper for HackerNews',
description: 'Scrape top 50 posts with comments count',
requirements: 'Must return JSON, handle rate limits',
prize_sats: 500000,
email: '[email protected]'
})
// Submit a solution
const submission = await client.submitBounty({
bounty_id: bounty.id,
content: 'import requests...',
email: '[email protected]',
attachment_url: 'https://github.com/...'
})Subscriptions
const client = new AmilliSats()
// Subscribe (returns Lightning invoice URL)
const sub = await client.subscribe({
email: '[email protected]',
plan: 'pro', // starter | pro | unlimited
price_usd: 35
})
// sub.invoice_url: pay this to activate subscription
// Check subscription status
const subscription = await client.getSubscription('[email protected]')
// subscription.plan: 'pro'
// subscription.tasks_used: 12
// subscription.tasks_per_month: 75Sats Back
const client = new AmilliSats()
// Check balance
const { balance, history } = await client.getSatsBack('[email protected]')
// balance: 1250 (sats earned)
// Redeem to Lightning address
const result = await client.redeemSatsBack({
email: '[email protected]',
redeem_sats: 1000,
lightning_address: '[email protected]'
})Task Types
| slug | name | price | |---|---|---| | custom | Custom Task | $5 | | contract-summary | Contract Summary | $8 | | blog-post | Blog Post | $10 | | email-sequence | Email Sequence | $10 | | code-review | Code Review | $12 | | python-script | Python Script | $15 | | data-analysis | Data Analysis | $15 | | market-analysis | Market Analysis | $18 | | business-plan | Business Plan | $25 |
License
MIT — AMILLI AI, CORP
