API Reference

Welcome to the Animus API reference documentation. Our APIs are designed to provide a simple and flexible way to integrate with our platform.

Authentication

All API requests require an API key for authentication. You can obtain an API key from your Animus dashboard. Include your API key in the Authorization header for all requests:
Authorization: Bearer your_api_key
Never expose your API key in client-side code or public repositories. Always handle API keys securely.

Base URL

All API requests should be sent to the following base URL:
https://api.animusai.co/v2

API Endpoints

Animus offers the following primary endpoints:
EndpointDescription
/chat/completionsGenerate chat completions from a given prompt
/media/completionsGenerate completions with vision capabilities using images and text
/generate/imageGenerate images from text prompts
/media/categoriesAnalyze media content and extract metadata

Making API Requests

You can make requests to our API using any HTTP client. Here’s a simple example using cURL:
curl https://api.animusai.co/v2/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "vivian-llama3.1-70b-1.0-fp8",
    "messages": [
      {"role": "user", "content": "Hello, how are you?"}
    ]
  }'

JavaScript Example

async function getCompletion() {
  const response = await fetch('https://api.animusai.co/v2/chat/completions', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${process.env.ANIMUS_API_KEY}`
    },
    body: JSON.stringify({
      model: 'vivian-llama3.1-70b-1.0-fp8',
      messages: [
        { role: 'user', content: 'Hello, how are you?' }
      ]
    })
  });
  
  const data = await response.json();
  return data.choices[0].message.content;
}

Media Completions Example

For vision-enabled completions with images:
async function getMediaCompletion() {
  const response = await fetch('https://api.animusai.co/v2/media/completions', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${process.env.ANIMUS_API_KEY}`
    },
    body: JSON.stringify({
      model: 'animuslabs/Qwen2-VL-NSFW-Vision-1.2',
      messages: [
        {
          role: 'user',
          content: [
            {
              type: 'image_url',
              image_url: {
                url: 'https://example.com/image.jpg'
              }
            },
            {
              type: 'text',
              text: 'Generate a detailed description for this image'
            }
          ]
        }
      ],
      temperature: 0.1
    })
  });
  
  const data = await response.json();
  return data.choices[0].message.content;
}

Python Example

import requests

url = "https://api.animusai.co/v2/chat/completions"
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {API_KEY}"  # Replace with your API key
}

payload = {
    "model": "vivian-llama3.1-70b-1.0-fp8",
    "messages": [
        {"role": "user", "content": "Hello, how are you?"}
    ]
}

response = requests.post(url, headers=headers, json=payload)
data = response.json()
print(data['choices'][0]['message']['content'])

Media Completions Python Example

import requests

url = "https://api.animusai.co/v2/media/completions"
headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {API_KEY}"  # Replace with your API key
}

payload = {
    "model": "animuslabs/Qwen2-VL-NSFW-Vision-1.2",
    "messages": [
        {
            "role": "user",
            "content": [
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://example.com/image.jpg"
                    }
                },
                {
                    "type": "text",
                    "text": "Generate a detailed description for this image"
                }
            ]
        }
    ],
    "temperature": 0.1
}

response = requests.post(url, headers=headers, json=payload)
data = response.json()
print(data['choices'][0]['message']['content'])

Rate Limits

To ensure fair usage and system reliability, we implement rate limits on our API. The specific limits depend on your subscription tier:
TierRequests per minuteTokens per minute
Free1010,000
Pro60100,000
EnterpriseCustomCustom
If you exceed these limits, you’ll receive a 429 Too Many Requests response. Implement appropriate retry logic with exponential backoff in your applications.

Error Handling

Our API uses standard HTTP response codes:
CodeDescription
200Success
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
403Forbidden - You don’t have permission
404Not Found - Resource doesn’t exist
429Too Many Requests - Rate limit exceeded
500Server Error - Something went wrong on our end
Error responses will include a JSON object with more details:
{
  "error": {
    "message": "Description of the error",
    "type": "error_type",
    "code": "error_code"
  }
}

Versioning

Our API uses versioning to ensure compatibility as we evolve. The current version is v2, which is reflected in the base URL. We’ll provide ample notice before deprecating any version.

Support

If you need assistance with our API, please contact us at support@animusai.co or visit our support portal.