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
| Name | Type | Required | Description |
|---|---|---|---|
| message | string | Yes | The message to send to the AI |
| model | string | No | AI model to use (default: gpt-4) |
| temperature | number | No | Creativity 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
| Name | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Description of the image to generate |
| size | string | No | Image size: 256x256, 512x512, 1024x1024 |
| style | string | No | Style: 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
| Name | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Text to translate |
| from | string | No | Source language (auto-detect if not provided) |
| to | string | Yes | Target 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
| Name | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Text to convert to speech |
| voice | string | No | Voice ID: male, female, neutral |
| speed | number | No | Speech 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"
}
}