REST API
REST API Reference
Complete documentation for the PeerCat REST API. Generate images, chat with AI, and perform research programmatically.
Overview
Base URL
https://api.peerc.atAuthentication
Authorization: Bearer your-api-keyRate Limits
Requests per minute:60
Requests per day:10,000
Concurrent requests:10
Endpoints
POST
/v1/images/generateGenerate images from text prompts
Request Body
json
{
"prompt": "A cat wearing sunglasses",
"model": "flux-2-pro",
"width": 1024,
"height": 1024
}Response
json
{
"id": "img_abc123",
"url": "https://cdn.peerc.at/images/...",
"model": "flux-2-pro",
"created": 1732700000
}POST
/v1/chat/completionsGenerate chat completions
Request Body
json
{
"model": "claude-opus-4.5",
"messages": [
{"role": "user", "content": "Hello!"}
],
"stream": false
}Response
json
{
"id": "chat_xyz789",
"choices": [{
"message": {
"role": "assistant",
"content": "Hello! How can I help?"
}
}],
"usage": {"prompt_tokens": 10, "completion_tokens": 8}
}POST
/v1/researchPerform deep research on a topic ($1.00 flat rate)
Request Body
json
{
"query": "Latest developments in AI regulation"
}Response
json
{
"id": "res_def456",
"summary": "...",
"sections": [...],
"sources": [...],
"cost": 1.00
}GET
/v1/modelsList available models
Response
json
{
"models": [
{"id": "flux-2-pro", "type": "image", "price_per_image": 0.075},
{"id": "claude-opus-4.5", "type": "chat", "price_per_1m_input": 6.25},
{"id": "gpt-5", "type": "chat", "price_per_1m_input": 5.00},
...
]
}GET
/v1/account/balanceCheck your credit balance
Response
json
{
"credits": 42.50,
"pcat_balance": 1000,
"pcat_weekly_spent": 125.00,
"pcat_weekly_limit": 500.00
}Error Codes
| Code | Description |
|---|---|
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing API key |
| 402 | Payment Required - Insufficient credits |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error - Try again later |
Prefer SDKs?
Use our official SDKs for type-safe integration with automatic retries and error handling.
View SDKs