API Reference

Authentication

All API requests require authentication using your API key.

Authorization: Bearer YOUR_API_KEY

Endpoints

POST /api/chat

Send a message to the agent.

Request Body:

{
    "message": "Your message here",
    "chat_id": "optional_chat_id"
}

Response:

{
    "success": true,
    "response": "AI response",
    "tokens_used": 123,
    "cost": 0.0012
}

GET /api/models

Get list of available models.

Response:

{
    "models": [
        {
            "id": "google/gemini-2.5-flash",
            "name": "Gemini 2.5 Flash",
            "provider": "Google",
            "input_cost": 0.30,
            "output_cost": 2.50
        }
    ]
}

Error Codes

Code Description
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid API key
402 Payment Required - Insufficient credits
404 Not Found - Resource not found
429 Too Many Requests - Rate limit exceeded
500 Internal Server Error