Documentation

Everything you need to integrate AIFuel into your applications.

Quick Start

1. Get your API Key

Connect your wallet at dashboard and create an API key.

2. Install the SDK

Use the official OpenAI SDK - our API is fully compatible.

bash
# Python
pip install openai

# Node.js
npm install openai

3. Make your first request

python
from openai import OpenAI

client = OpenAI(
    api_key="fuel_sk_your_key_here",
    base_url="https://api.aifuel.fun/v1"
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "user", "content": "Hello, AIFuel!"}
    ]
)

print(response.choices[0].message.content)

API Reference

Base URL

https://api.aifuel.fun/v1

Authentication

Include your API key in the Authorization header:

http
Authorization: Bearer fuel_sk_your_key_here

Endpoints

POST/v1/chat/completionsChat completions (GPT-4, Claude, etc.)
POST/v1/completionsText completions
POST/v1/embeddingsText embeddings
GET/v1/modelsList available models
GET/v1/creditsCheck your credit balance

Available Models

Model IDProviderTier
gpt-4oOpenAIpremium
gpt-4o-miniOpenAIstandard
claude-3.5-sonnetAnthropicpremium
claude-3-haikuAnthropicbudget
deepseek-chatDeepSeekbudget
deepseek-reasonerDeepSeekstandard
llama-3.1-70bMetastandard
gemini-1.5-proGooglepremium
+ 190 more models available via OpenRouter

Code Examples

Python

python
from openai import OpenAI

client = OpenAI(
    api_key="fuel_sk_xxx",
    base_url="https://api.aifuel.fun/v1"
)

# Chat completion
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain quantum computing in simple terms."}
    ],
    temperature=0.7,
    max_tokens=500
)

print(response.choices[0].message.content)

# Streaming
stream = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Write a short poem"}],
    stream=True
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Node.js / TypeScript

typescript
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'fuel_sk_xxx',
  baseURL: 'https://api.aifuel.fun/v1',
});

async function main() {
  const response = await client.chat.completions.create({
    model: 'gpt-4o',
    messages: [
      { role: 'user', content: 'Hello, AIFuel!' }
    ],
  });

  console.log(response.choices[0].message.content);
}

main();

cURL

bash
curl https://api.aifuel.fun/v1/chat/completions \
  -H "Authorization: Bearer fuel_sk_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'

Credit System

How Credits Work

Your daily credit is calculated based on your $FUEL token holdings:

Daily Credit = (Your Balance / Circulating Supply) × Daily Pool × Multiplier
  • • Credits refresh daily at midnight UTC
  • • Diamond hands (never sold) get 100% multiplier
  • • Former sellers capped at 80% multiplier
  • • Check your credit balance at GET /v1/credits