API Reference
The RunAnythingAI API gives you programmatic access to our suite of AI capabilities, including text generation, character-driven interactions, text-to-speech conversion, and status tracking. This reference provides comprehensive documentation for each endpoint, including parameters, response formats, and practical examples to get you started quickly.
Base URL
All API endpoints are accessed through our secure base URL:
https://api.runanythingai.com
Authentication
Every API request requires authentication using your unique API key. Include your key in the Authorization header using Bearer token authentication:
Authorization: Bearer YOUR_API_KEY
You can find your API key in your RunAnythingAI dashboard. Keep it secure and never expose it in client-side code.
Response Format
All API responses are returned in JSON format with a consistent structure:
- Status codes indicate the outcome of your request
- Response data contains the information you requested
- Error messages provide details when something goes wrong
Successful Response Structure
{
"id": "unique-request-id",
"data": {
// Response content varies by endpoint
},
"status": "success"
}
Error Response Structure
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable error description"
},
"status": "error"
}
Rate Limits
To ensure optimal performance for all users, we enforce the following rate limits:
| Endpoint Type | Limit | Time Window |
|---|---|---|
| Text Generation | 100 requests | per minute |
| Text-to-Speech | 60 requests | per minute |
| Status Checks | 200 requests | per minute |
When you exceed a rate limit, the API returns a 429 Too Many Requests status code. We recommend implementing exponential backoff in your applications to handle rate limiting gracefully.
Each response includes headers showing your current rate limit status:
X-RateLimit-Limit: Your rate limitX-RateLimit-Remaining: Requests remaining in the current windowX-RateLimit-Reset: Time when the limit resets
Error Handling
The API uses standard HTTP status codes to indicate request outcomes. Here's what each status code means:
| Status Code | Meaning | Description |
|---|---|---|
200 | Success | Request completed successfully |
400 | Bad Request | Invalid request format or missing required parameters |
401 | Unauthorized | Authentication failed or API key invalid |
403 | Forbidden | API key valid but lacks permission for this resource |
429 | Too Many Requests | Rate limit exceeded - slow down your requests |
500 | Internal Server Error | Something went wrong on our end |
503 | Service Unavailable | Temporary service disruption |
Error Response Details
When an error occurs, you'll receive a detailed response to help troubleshoot:
{
"error": {
"code": "INVALID_PARAMETER",
"message": "The 'messages' parameter is required but was not provided",
"details": {
"parameter": "messages",
"expected_type": "array"
}
},
"status": "error",
"timestamp": "2024-01-15T10:30:00Z"
}
- Always check the status code before processing response data
- Log error details for debugging
- Implement retry logic for
5xxerrors with exponential backoff - Handle
429errors by respecting rate limits
Available Endpoints
The RunAnythingAI API provides four main categories of endpoints:
Text Generation
Generate natural language responses using our advanced AI models.
- POST
/api/text/{model_id}- Generate text with customizable models - POST
/api/text/default- Quick text generation with default settings
Character Endpoints
Create immersive, character-driven interactions with specialized AI personalities.
- POST
/api/text/Witch- Fantasy witch character interactions - POST
/api/text/Mage- Wise mage character interactions - POST
/api/text/Succubus- Seductive character interactions - POST
/api/text/Lightning- High-energy character interactions
Text-to-Speech
Convert generated text into natural-sounding audio.
- POST
/api/tts- Convert text to speech with voice options
Status Tracking
Monitor the progress of your AI processing tasks.
- GET
/api/status/{task_id}- Check the status of async operations
Next Steps
Ready to start building? Here's what to explore next:
- Getting Started - Set up your environment and make your first API call
- Text Generation API - Learn about our core text generation capabilities
- Character Endpoints - Dive into character-driven interactions
- API Workflows - Combine endpoints for powerful features
Need help? Check out our code examples or reach out to our support team.