API Reference

ParrotRouter provides an OpenAI-compatible API that works with existing SDKs and tools.

Base URL

https://api.parrotrouter.com/v1

Authentication

All API requests require authentication using a Bearer token in the Authorization header:

curl https://api.parrotrouter.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

Endpoints

Response Format

All responses follow the OpenAI format for compatibility:

Successful Responsejson
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "gpt-4",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Hello! How can I help you today?"
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 12,
    "total_tokens": 21
  }
}

Error Handling

Errors are returned with appropriate HTTP status codes:

Error Responsejson
{
  "error": {
    "message": "Invalid API key provided",
    "type": "authentication_error",
    "code": "invalid_api_key"
  }
}

Quick Links