API Reference

AI Endpoints

Powerful AI capabilities accessible with $PYRE token payments.

Chat Completion

POST/api/ai/chat
$0.05
per request

Get AI-powered responses to your messages

Parameters

NameTypeRequiredDescription
messagestringYesThe message to send to the AI
modelstringNoAI model to use (default: gpt-4)
temperaturenumberNoCreativity level 0-1 (default: 0.7)

Request

{
  "message": "Explain quantum computing simply",
  "model": "gpt-4"
}

Response

{
  "success": true,
  "data": {
    "message": "Quantum computing uses quantum mechanics principles...",
    "model": "gpt-4",
    "tokens": 150
  }
}

Image Generation

POST/api/ai/image
$0.10
per request

Generate images from text descriptions

Parameters

NameTypeRequiredDescription
promptstringYesDescription of the image to generate
sizestringNoImage size: 256x256, 512x512, 1024x1024
stylestringNoStyle: realistic, artistic, cartoon

Request

{
  "prompt": "A futuristic city at sunset",
  "size": "512x512"
}

Response

{
  "success": true,
  "data": {
    "imageUrl": "https://...",
    "prompt": "A futuristic city at sunset",
    "size": "512x512"
  }
}

Translation

POST/api/ai/translate
$0.03
per request

Translate text between languages

Parameters

NameTypeRequiredDescription
textstringYesText to translate
fromstringNoSource language (auto-detect if not provided)
tostringYesTarget language code (en, es, fr, etc.)

Request

{
  "text": "Hello, how are you?",
  "to": "es"
}

Response

{
  "success": true,
  "data": {
    "original": "Hello, how are you?",
    "translated": "¡Hola, cómo estás?",
    "from": "en",
    "to": "es"
  }
}

Text-to-Speech

POST/api/ai/tts
$0.08
per request

Convert text to natural-sounding speech

Parameters

NameTypeRequiredDescription
textstringYesText to convert to speech
voicestringNoVoice ID: male, female, neutral
speednumberNoSpeech speed 0.5-2.0 (default: 1.0)

Request

{
  "text": "Welcome to PYRE",
  "voice": "female"
}

Response

{
  "success": true,
  "data": {
    "audioUrl": "https://...",
    "duration": 2.5,
    "format": "mp3"
  }
}