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 openai3. 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/v1Authentication
Include your API key in the Authorization header:
http
Authorization: Bearer fuel_sk_your_key_hereEndpoints
POST
/v1/chat/completionsChat completions (GPT-4, Claude, etc.)POST
/v1/completionsText completionsPOST
/v1/embeddingsText embeddingsGET
/v1/modelsList available modelsGET
/v1/creditsCheck your credit balanceAvailable Models
| Model ID | Provider | Tier |
|---|---|---|
gpt-4o | OpenAI | premium |
gpt-4o-mini | OpenAI | standard |
claude-3.5-sonnet | Anthropic | premium |
claude-3-haiku | Anthropic | budget |
deepseek-chat | DeepSeek | budget |
deepseek-reasoner | DeepSeek | standard |
llama-3.1-70b | Meta | standard |
gemini-1.5-pro | premium |
+ 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