Integration
Provider Integration (Full)
Provider setup involves dashboard configuration followed by SDK integration. The examples below illustrate wrapping endpoints for monetization, preserving your API's original logic while adding payment gates.
Keep the Express, FastAPI, and Next.js examples as provided earlier—they demonstrate real-world usage with minimal intrusion.
Consumer Integration
Consumers use SDK clients to handle payments and calls programmatically.
TypeScript Client
npm install @qwery/sdkimport { QweryClient } from '@qwery/sdk';
import { Keypair } from '@solana/web3.js';
const qwery = new QweryClient({
apiKey: process.env.QWERY_CONSUMER_KEY!,
apiSecret: process.env.QWERY_CONSUMER_SECRET!,
wallet: Keypair.fromSecretKey(privateKeyBytes),
network: 'mainnet-beta',
});
await qwery.setLimits({
perCallMax: 5.0,
dailyLimit: 100.0,
monthlyLimit: 1000.0,
});
const result = await qwery.call('sentiment-analyzer', {
endpoint: '/api/sentiment',
method: 'POST',
data: { text: 'I love Solana!' },
});
console.log(result.data);
console.log(result.qwery.cost_usdc);
console.log(result.qwery.solana_signature);This client automates transaction building, signing, and broadcasting, then appends metadata to responses.
Python Client
pip install qwery-paymentsfrom qwery_payments import QweryClient
from solders.keypair import Keypair
qwery = QweryClient(
api_key="QWERY_ck_live_...",
api_secret="QWERY_cs_live_...",
wallet=Keypair.from_bytes(private_key_bytes),
network="mainnet-beta",
)
qwery.set_limits(
per_call_max=5.0,
daily_limit=100.0,
monthly_limit=1000.0,
)
result = qwery.call(
"sentiment-analyzer",
endpoint="/api/sentiment",
data={"text": "I love Solana!"},
)
print(result["sentiment"])
print(result["_qwery"]["cost_usdc"])
print(result["_qwery"]["solana_signature"])Similar to TypeScript, with Pythonic syntax and async support for high-throughput agents.
Last updated