aiprox-openai
v1.0.0
Published
Drop-in OpenAI SDK replacement powered by AIProx — one package, three payment rails, nineteen models, ten agents
Maintainers
Readme
aiprox-openai
Drop-in replacement for the OpenAI SDK. One package. Three rails. Nineteen models. Ten agents.
Pay with Bitcoin Lightning, Solana USDC, or Base — your apiKey format determines the rail automatically.
Install
npm install aiprox-openaiUsage
// Before (OpenAI):
import OpenAI from 'openai'
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY })
// After — Lightning:
import OpenAI from 'aiprox-openai'
const client = new OpenAI({ apiKey: process.env.LIGHTNINGPROX_SPEND_TOKEN }) // lnpx_...
// After — Solana:
import OpenAI from 'aiprox-openai'
const client = new OpenAI({ apiKey: process.env.SOLANA_WALLET_ADDRESS }) // base58
// After — Base:
import OpenAI from 'aiprox-openai'
const client = new OpenAI({ apiKey: process.env.BASE_WALLET_ADDRESS }) // 0x...
// Everything else stays identical:
const response = await client.chat.completions.create({
model: 'claude-opus-4-5-20251101',
messages: [{ role: 'user', content: 'Summarize the latest AI news' }]
})
console.log(response.choices[0].message.content)The rail is detected automatically from the apiKey format. No config needed.
What's different
AIProx routes your task through its multi-agent orchestrator. The last user message becomes the task. The orchestrator selects the best available agent and returns the result in standard OpenAI format.
Bonus: response._aiprox contains the receipt — which agents ran, what was spent, how long it took.
console.log(response._aiprox)
// {
// agents_used: ['lightningprox'],
// total_sats_spent: 30,
// duration_ms: 524,
// receipt_id: 'orch_1773...'
// }Auth — three rails, one constructor
| apiKey format | Rail | Payment |
|---------------|------|---------|
| lnpx_... | Bitcoin Lightning | Sats per request |
| 0x... (40+ chars) | Base/EVM | USDC on Base |
| base58 (32-44 chars) | Solana | SOL or USDC |
Get a Lightning spend token: lightningprox.com Fund a Solana wallet: solanaprox.com Register: aiprox.dev
Supported models (19 across 5 providers)
| Model | Provider |
|-------|----------|
| claude-opus-4-5-20251101 | Anthropic |
| gpt-4-turbo | OpenAI |
| meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8 | Together.ai |
| meta-llama/Llama-3.3-70B-Instruct-Turbo | Together.ai |
| mistral-large-latest | Mistral |
| magistral-medium-latest | Mistral (Reasoning) |
| gemini-2.5-flash | Google |
| gemini-2.5-pro | Google |
| (+ 11 more) | |
Full list: aiprox.dev/api/agents
Error handling
try {
const r = await client.chat.completions.create({ ... })
} catch (err) {
if (err.code === 'insufficient_balance') {
// err.status === 402 — top up at aiprox.dev
}
if (err.code === 'no_agent_available') {
// err.status === 404 — no agent for this capability
}
}Docs
aiprox.dev · Built by LPX Digital Group LLC
