Skip to main content

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
tip

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 TypeLimitTime Window
Text Generation100 requestsper minute
Text-to-Speech60 requestsper minute
Status Checks200 requestsper 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.

Rate Limit Headers

Each response includes headers showing your current rate limit status:

  • X-RateLimit-Limit: Your rate limit
  • X-RateLimit-Remaining: Requests remaining in the current window
  • X-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 CodeMeaningDescription
200SuccessRequest completed successfully
400Bad RequestInvalid request format or missing required parameters
401UnauthorizedAuthentication failed or API key invalid
403ForbiddenAPI key valid but lacks permission for this resource
429Too Many RequestsRate limit exceeded - slow down your requests
500Internal Server ErrorSomething went wrong on our end
503Service UnavailableTemporary 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"
}
Best Practices
  • Always check the status code before processing response data
  • Log error details for debugging
  • Implement retry logic for 5xx errors with exponential backoff
  • Handle 429 errors 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:

  1. Getting Started - Set up your environment and make your first API call
  2. Text Generation API - Learn about our core text generation capabilities
  3. Character Endpoints - Dive into character-driven interactions
  4. API Workflows - Combine endpoints for powerful features

Need help? Check out our code examples or reach out to our support team.