API Documentation

Comprehensive API documentation for integrating with AllAI's unified AI platform.

Base URL: https://api.allai.co.in
JWT Authentication
Real-time responses

Authentication

Secure API access with JWT tokens

POST/api/v1/auth/login

User login

POST/api/v1/auth/register

User registration

POST/api/v1/auth/refresh

Refresh JWT token

POST/api/v1/auth/logout

User logout

AI Chat

Interact with multiple AI models

POST/api/v1/chat/send

Send message to AI

GET/api/v1/chat/history

Get chat history

DELETE/api/v1/chat/clear

Clear chat history

POST/api/v1/chat/stream

Stream AI response

AI Models

Access to premium AI services

POST/api/v1/ai/openai

OpenAI (ChatGPT-4, DALL-E)

POST/api/v1/ai/anthropic

Anthropic (Claude-3)

POST/api/v1/ai/gemini

Google Gemini Pro

POST/api/v1/ai/grok

xAI Grok

POST/api/v1/ai/perplexity

Perplexity AI

POST/api/v1/ai/deepseek

DeepSeek Coder

User Management

User profile and subscription management

GET/api/v1/user/profile

Get user profile

PUT/api/v1/user/profile

Update user profile

GET/api/v1/user/subscription

Get subscription status

POST/api/v1/user/usage

Get usage statistics

Subscriptions

Manage subscription and billing

POST/api/v1/subscription/create

Create subscription

PUT/api/v1/subscription/update

Update subscription

DELETE/api/v1/subscription/cancel

Cancel subscription

GET/api/v1/subscription/invoices

Get invoices

Code Examples

Send a message to ChatGPT-4

JavaScript
const response = await fetch('/api/v1/ai/openai', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer YOUR_JWT_TOKEN'
  },
  body: JSON.stringify({
    model: 'gpt-4',
    message: 'Hello, how can you help me today?',
    temperature: 0.7,
    max_tokens: 1000
  })
});

const data = await response.json();
console.log(data.response);

Stream AI response

Python
import requests

response = requests.post(
    'https://api.allai.co.in/api/v1/chat/stream',
    headers={
        'Authorization': 'Bearer YOUR_JWT_TOKEN',
        'Content-Type': 'application/json'
    },
    json={
        'model': 'claude-3-sonnet',
        'message': 'Explain quantum computing',
        'stream': True
    },
    stream=True
)

for line in response.iter_lines():
    if line:
        data = json.loads(line.decode('utf-8'))
        print(data.get('content', ''), end='')

Get user profile

cURL
curl -X GET "https://api.allai.co.in/api/v1/user/profile" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json"

Rate Limits & Pricing

Free Tier

  • • 100 API calls per month
  • • Basic AI models only
  • • Standard response times

Premium Tier

  • • Unlimited API calls
  • • All premium AI models
  • • Priority response times
  • • Advanced features

Rate Limit Headers

All API responses include rate limit headers: X-RateLimit-Limit,X-RateLimit-Remaining, andX-RateLimit-Reset.

Getting Started

1

Get Your API Key

Sign up for an account and generate your API key from the dashboard.

2

Choose Your AI Model

Select from our range of premium AI models based on your needs.

3

Make Your First API Call

Get started with our API in just a few minutes. We've provided examples in multiple programming languages.

Need Help?

We're here to help you succeed with our API. Contact our support team for assistance.