API Documentation
Complete guide to integrating with the NeuraNET distributed GPU compute network
OpenAPI Specification
Full OpenAPI 3.1 specification available for code generation and API exploration:
Quick Start
Get started in 3 steps:
Sign a message with your wallet to create an API key for server-to-server auth
Send SOL once, then create unlimited jobs without per-transaction fees
Submit prompts, receive results via polling, SSE streaming, or webhooks
Authentication
Two Authentication Methods
API Key (Recommended)
Best for servers and backend integrations. Create once, use everywhere.
Authorization: Bearer nn_live_xxx→ Create API Key in DashboardWallet Signature
For browser apps. Sign messages with your Solana wallet.
x-wallet-address, x-signature, x-messageOr create via API:
# Create API key (requires wallet signature)
curl -X POST https://api.neuranet.network/api/keys \
-H "Content-Type: application/json" \
-H "x-wallet-address: YOUR_WALLET" \
-H "x-signature: YOUR_SIGNATURE" \
-H "x-message: YOUR_MESSAGE" \
-d '{"name": "My Production Key"}'
# Response: { "apiKey": "nn_live_xxxxx", ... }JavaScript/TypeScript SDK
Install the SDK
npm install @neuranet/sdkimport { NeuraNET } from '@neuranet/sdk';
const client = new NeuraNET({
apiKey: 'nn_live_xxxxxxxxxxxxx',
apiUrl: 'https://api.neuranet.network/api'
});
// Set your wallet address
client.setWalletAddress('YourSolanaWallet');
// Create a job using prepaid credits
const job = await client.createJob({
model: 'llama2-7b',
prompt: 'Write a story about AI',
maxTokens: 1000,
paymentAmount: 0.05
});
// Wait for the result
const result = await client.waitForJob(job.jobId);
console.log(result.result);Image Generation
Generate Images with Stable Diffusion
Create stunning images using ComfyUI-powered nodes. Supports text-to-image and image-to-image workflows.
Text to Image
Generate images from text descriptions. Supports SD 1.5, SDXL, and other checkpoints.
jobType: "image-generation"Image to Image
Transform existing images using prompts. Great for style transfer and edits.
jobType: "image-to-image"SDK Example
// Create an image generation job
const imageJob = await client.createJob({
jobType: 'image-generation',
prompt: 'A majestic dragon flying over mountains at sunset, highly detailed, 8k',
negativePrompt: 'blurry, low quality, distorted',
width: 1024,
height: 1024,
steps: 25,
cfgScale: 7,
paymentAmount: 0.02
});
// Wait for result
const result = await client.waitForJob(imageJob.jobId);
console.log('Image URL:', result.imageUrl);
// Note: Images expire after 48 hoursREST API
# Create image generation job
curl -X POST https://api.neuranet.network/api/jobs \
-H "Authorization: Bearer nn_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"createdBy": "YOUR_WALLET",
"jobType": "image-generation",
"prompt": "A cyberpunk city at night, neon lights",
"negativePrompt": "blurry, ugly, distorted",
"width": 1024,
"height": 1024,
"steps": 25,
"cfgScale": 7,
"paymentAmount": 0.02,
"paymentMethod": "credits"
}'- •
jobType* - "image-generation" or "image-to-image" - •
prompt* - Positive prompt describing the image - •
negativePrompt- Things to avoid in the image - •
width- Image width: 512, 768, or 1024 (default: 512) - •
height- Image height: 512, 768, or 1024 (default: 512) - •
steps- Sampling steps: 1-100 (default: 20) - •
cfgScale- CFG scale: 1-30 (default: 7)
⚠️ Image Storage
Generated images are stored for 48 hours after creation. Download or save images before they expire. The imageExpiresAt field indicates when the image will be deleted.
Prepaid Credits
Deposit Once, Create Many Jobs
No per-job transactions! Deposit SOL to your credit balance, then create jobs instantly without signing each transaction.
# 1. Get deposit info
curl https://api.neuranet.network/api/credits/deposit-info
# 2. Send SOL to platform wallet (use your wallet app)
# 3. Deposit credits with tx signature
curl -X POST https://api.neuranet.network/api/credits/deposit \
-H "Authorization: Bearer nn_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{"amount": 0.5, "txSignature": "YOUR_TX_SIGNATURE"}'SDK Usage
// Check credit balance
const balance = await client.getCreditBalance();
console.log('Balance:', balance.balance, 'SOL');
// Deposit credits after sending SOL
await client.depositCredits(0.5, 'your-tx-signature');
// List available models
const models = await client.listModels();Webhooks
Receive Results via HTTP POST
Instead of polling, have results delivered directly to your server when jobs complete.
// Create job with webhook callback
const job = await client.createJob({
model: 'mistral-7b',
prompt: 'Summarize this document',
paymentAmount: 0.03,
callbackUrl: 'https://myapp.com/webhooks/neuranet',
callbackHeaders: {
'Authorization': 'Bearer my-secret'
}
});
// Result will be POSTed to your callback URLWebhook Payload
// Webhook POST payload sent to your callbackUrl
{
"event": "job.completed",
"timestamp": "2026-01-08T12:34:56.789Z",
"job": {
"jobId": "abc123-...",
"status": "completed",
"modelRequired": "llama2-7b",
"prompt": "Your original prompt",
"result": "The AI generated response...",
"paymentAmount": 0.05,
"paymentVerified": true,
"completedAt": "2026-01-08T12:34:56.789Z"
}
}Real-Time Streaming
Server-Sent Events (SSE)
Connect to receive real-time job status updates. Perfect for chat interfaces and live dashboards.
GET https://api.neuranet.network/api/stream/jobs/:jobIdEvent Types
- •
job:status- Status changed (pending → processing → completed) - •
job:progress- Partial result (if streaming enabled) - •
job:complete- Final result available - •
job:error- Job failed
// Browser: EventSource for real-time updates
const eventSource = new EventSource('https://api.neuranet.network/api/stream/jobs/JOB_ID');
eventSource.addEventListener('job:status', (e) => {
console.log('Status:', JSON.parse(e.data));
});
eventSource.addEventListener('job:complete', (e) => {
const { result } = JSON.parse(e.data);
console.log('Result:', result);
eventSource.close();
});
eventSource.addEventListener('job:error', (e) => {
console.error('Error:', JSON.parse(e.data));
eventSource.close();
});API Reference
Create Job
POST /api/jobs# Create job using credits
curl -X POST https://api.neuranet.network/api/jobs \
-H "Authorization: Bearer nn_live_xxxxx" \
-H "Content-Type: application/json" \
-d '{
"createdBy": "YOUR_WALLET_ADDRESS",
"modelRequired": "llama2-7b",
"prompt": "Write a poem about the ocean",
"maxTokens": 500,
"paymentAmount": 0.02,
"paymentMethod": "credits"
}'- •
createdBy* - Your wallet address - •
jobType- "text-generation", "image-generation", or "image-to-image" - •
modelRequired* - AI model name (for text jobs) - •
prompt* - Input prompt - •
paymentAmount* - Amount in SOL - •
paymentMethod- "credits" or "direct" (default: direct) - •
callbackUrl- Webhook URL for results - •
streamingEnabled- Enable partial results via SSE
- •
negativePrompt- What to avoid in the image - •
width/height- Image dimensions (512, 768, 1024) - •
steps- Sampling steps (1-100) - •
cfgScale- Classifier-free guidance scale (1-30)
GET /api/nodes
GETList available GPU compute nodes with filtering.
// Get available nodes
const response = await fetch(
'https://api.neuranet.network/api/nodes?status=online&minVRAM=8'
);
const data = await response.json();
const nodes = data.response.items;
nodes.forEach(node => {
console.log(`${node.gpuModel} - ${node.vramGB}GB`);
});- •
status- Filter by status (online, offline, busy) - •
minVRAM- Minimum VRAM in GB - •
capability- Filter by capability (textGeneration, imageGeneration) - •
page- Page number (default: 1) - •
pageSize- Items per page (default: 20)
/api/jobs/:jobId/api/jobs/api/nodes/available-models/list/api/credits/balance/api/credits/deposit/api/stream/jobs/:jobIdError Codes
PAY_001Payment verification failed - Transaction not found or invalidPAY_006Insufficient credits - deposit more SOL to your balanceJOB_005No GPU nodes available for this modelJOB_006Invalid job parametersAUTH_001Invalid API key or wallet signatureRATE_001Rate limit exceeded