Puma API
API

Create a chat completion

OpenRouter-compatible endpoint. Sends the messages to Workers AI and returns an OpenAI-format response.

POST
/api/v1/chat/completions

OpenRouter-compatible endpoint. Sends the messages to Workers AI and returns an OpenAI-format response.

Authorization

bearerAuth
AuthorizationBearer <token>

Bearer token authentication. Any token value is accepted.

In: header

Header Parameters

HTTP-Referer?string

Optional site URL for rankings (OpenRouter compat).

Formaturi
X-OpenRouter-Title?string

Optional site name for rankings (OpenRouter compat).

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

model?string

Model alias or any Workers AI text generation model name.

Default"puma/cheapest"
messages*array<>
Items1 <= items
temperature?number

(Accepted but not forwarded yet.)

max_tokens?integer

(Accepted but not forwarded yet.)

stream?boolean

Must be false or omitted. Streaming not yet supported.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://api.pumaai.com/api/v1/chat/completions" \  -H "Content-Type: application/json" \  -d '{    "messages": [      {        "role": "user",        "content": "What is the meaning of life?"      }    ]  }'
{  "id": "chatcmpl-550e8400-e29b-41d4-a716-446655440000",  "object": "chat.completion",  "created": 1712345678,  "model": "puma/cheapest",  "choices": [    {      "index": 0,      "message": {        "role": "assistant",        "content": "The meaning of life is a philosophical question that has been debated for centuries…"      },      "finish_reason": "stop"    }  ],  "usage": {    "prompt_tokens": 0,    "completion_tokens": 0,    "total_tokens": 0  }}