Documentation

Technical guides, API references, and architecture overviews for the AIL2 network.

Introduction to AIL2

AIL2 is a Layer 2 scaling solution specifically designed for Artificial Intelligence workloads. It bridges gap between massive compute requirements and distributed blockchain consensus, scaling intelligence to infinity.

Note: AIL2 Mainnet Beta is currently live. Developers can begin deploying models to our distributed GPU network immediately.

1. SDK Installation

To start developing with AIL2, please install our core SDK and its peer dependencies. The SDK provides all the tools needed to interact with the AIL2 network, submit inference tasks, and manage models.

bash
npm install @ail2/sdk ethers

After installation, you can import the SDK into your project and configure your Project ID and API Key for initialization:

javascript
import { AIL2Client } from '@ail2/sdk';

const client = new AIL2Client({
  projectId: 'your_project_id_here', // 从开发者控制台获取
  apiKey: 'your_api_key_here' // 妥善保管你的密钥
});

2. Ship in 5 Minutes

After obtaining your project_id from the Developer Console, you can start building with a single API call. Here is a complete example of submitting an inference task to the nebula-ai model:

bash
curl -X POST "https://api.ail2.network/v1/infer" \
  -H "Authorization: Bearer $AIL2_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "p_12345",
    "model_id": "nebula-ai",
    "input": {"prompt": "Explain decentralized AI in simple terms"}
  }'

Response Example:

json
{
  "task_id": "task_abc678def",
  "status": "processing",
  "results": "Decentralized AI distributes computation across a network..."
}

3. Core Concepts

Proof of Inference

The core consensus mechanism of the AIL2 network. Through Optimistic ZK-Rollup technology, it cryptographically verifies that the process of untrusted computing nodes executing AI models matches expectations exactly, ensuring the correctness of decentralized inference results and providing the incentive basis for honest nodes.

State Channels

An efficient off-chain transaction layer designed for infinite scalability. It allows users to perform high-frequency, low-cost micro-transactions and state interactions outside the AIL2 Core Rollup, syncing with the underlying blockchain only upon final settlement, greatly enhancing the composability and user experience of AI applications.

Token Economics

The incentive layer of the AIL2 ecosystem. Tokens are used to pay for network compute resources (GPU), stake to become validator nodes, participate in governance, and reward participants who provide computing power, storage, and verification services to the network, driving the continuous operation of the entire decentralized AI network.

4. API REFERENCE

Inference APIPOST/v1/infer

The core endpoint for submitting AI model inference tasks.

Request Body Parameters

  • project_id
    STRING / REQUIRED

    Your unique project identifier.

  • model_id
    STRING / REQUIRED

    The ID of the model to invoke (e.g., nebula-ai).

  • input
    OBJECT / REQUIRED

    Model-specific input data, usually containing fields like prompt.

  • parameters
    OBJECT / OPTIONAL

    Optional inference parameters, such as temperature, max_tokens.

Response: Returns a JSON object containing task_id, status, and asynchronous results.

Model RegistryGET/v1/models

The endpoint to query the list of available AI models or get specific model details.

Query Parameters

id
STRING / OPTIONAL

Specify the Model ID to get its detailed information. If omitted, the list is returned.

Response: Returns a model array or a single model object, containing metadata such as ID, name, description, input/output formats, etc.

5. Billing & Usage

AIL2 adopts a pay-as-you-go billing model. Fees are calculated based on the complexity of the AI model invoked, the GPU compute duration consumed (in seconds), and the volume of data processed (number of input/output tokens).

View Usage & Balance

You can view real-time details of resource consumption, remaining credits, and historical bills for your current project in the 'Billing' panel of the Developer Console.

Billing Alerts

The system will send an email alert when your credit falls below the set threshold, ensuring your AI service is not interrupted due to insufficient balance.

Payment Methods (Multi-Chain Support)

Currently supports settlement via AIL2 native tokens on the following six mainstream blockchains, fully leveraging AIL2's multi-chain advantage as a unified AI super layer:

ETHBSCGIWAXLayerBaseMantle