Ryzo AI API Documentation

Complete reference for developers

Authentication

All API requests require authentication using Bearer tokens. Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Getting Your API Key

  1. Create an account and log in to your dashboard
  2. Navigate to the API Instances page
  3. Create a new instance with your desired service type
  4. Copy the generated API key

API Key Security

  • Keep your API keys secure and never expose them in client-side code
  • Each API key has specific permissions based on the instance type
  • You can regenerate keys at any time from your dashboard
  • You can deactivate keys temporarily without deleting them
API Endpoints
POST
/api/v1/generate

Standard AI text generation with no memory or personality.

Request Parameters

{
  "prompt": "Write a story about robots",  // Required: The prompt to generate text from
  "max_tokens": 150,                       // Optional: Maximum number of tokens to generate (default: 1024)
  "temperature": 0.7,                      // Optional: Controls randomness (0-1, default: 0.7)
  "top_p": 0.9,                            // Optional: Controls diversity (0-1, default: 0.9)
  "stop": ["###"]                          // Optional: Sequences where the API will stop generating
}

Response Format

{
  "success": true,
  "text": "In the year 2150, robots had become an integral part of human society...",
  "usage": {
    "prompt_tokens": 5,
    "completion_tokens": 150,
    "total_tokens": 155
  },
  "credits_used": 1,
  "credits_remaining": 9999
}

Example Code

curl -X POST https://api.ryzo.ai/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Write a story about robots",
    "max_tokens": 150
  }'

Cost: 1 credit per request

Rate Limits

Request Limits

  • • 20 requests per minute per API key
  • • 1,000 requests per hour per API key
  • • 10,000 requests per day per API key

Rate limits are applied per API key, not per account. Creating multiple instances gives you separate rate limits.

Content Limits

  • • 4,000 characters maximum prompt length
  • • 2,048 tokens maximum per response
  • • 30 second timeout per request
  • • 20 messages per chat session
  • • 24 hour expiration for chat sessions

Rate Limit Headers

X-RateLimit-Limit: 20
X-RateLimit-Remaining: 19
X-RateLimit-Reset: 1623168000

These headers are included in every API response to help you track your rate limit usage.

Error Handling

HTTP Status Codes

200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
402Payment Required - Insufficient credits
403Forbidden - API key doesn't have permission
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Something went wrong

Error Response Format

{
  "success": false,
  "error": "Insufficient credits",
  "error_code": "INSUFFICIENT_CREDITS",
  "credits_remaining": 0,
  "timestamp": "2024-01-15T10:30:00Z"
}

Common Error Codes

INVALID_API_KEYThe API key is invalid or has been revoked
INSUFFICIENT_CREDITSNot enough credits to complete the request
RATE_LIMIT_EXCEEDEDToo many requests in the given time period
INVALID_PARAMETERSOne or more parameters are invalid
CONTENT_POLICY_VIOLATIONContent violates our usage policies

Error Handling Best Practices

  • Always check the HTTP status code and error message
  • Implement exponential backoff for rate limit errors (429)
  • Monitor your credit usage to avoid insufficient credit errors
  • Validate input parameters before sending requests
  • Log detailed error information for debugging
SDKs & Libraries

We provide official client libraries for popular programming languages to make integration easier.

JavaScript/TypeScript

npm install ryzo-ai

Full-featured client with TypeScript support and browser compatibility.

Python

pip install ryzo-ai

Python client with async support and convenient helpers.

PHP

composer require ryzo/ryzo-ai

PHP client with Laravel integration and PSR-18 compatibility.

SDK Documentation

For detailed SDK documentation, examples, and advanced usage, visit our GitHub repositories atgithub.com/ryzo-ai

Need Help?

Join our Discord community for support, updates, and to connect with other developers: