API Reference

The Coder Copilot Developer API lets you call AI models directly using an API key. No session cookie required — just pass your key and a prompt.

⚠️ The Developer API is in public beta. Token limits and model availability may change.

Base URL

https://codercopilot.firesmasher.workers.dev

Authentication

All inference endpoints require your API key. Pass it as a query parameter or as an HTTP header.

Query parameter (easiest)

POST /v1/model/orbus-low?apikey=dak_your_key_here

Header

x-api-key: dak_your_key_here

Keys start with dak_ and are 52 characters long. You can create up to 3 keys per account on the API Keys page.

Available Models

Three models are available for the Dev API, each with its own token budget:

Slug Token Limit Reset Period Msgs/min Best for
flux-plus 200 12 hours 2 Short, precise tasks
orbus-low 1500 12 hours 2 General use, longer conversations
nova-standard 500 12 hours 2 Balanced quality and quota

Token counts are approximate (≈ 1 token per 4 characters for input + output).

POST /v1/model/:model

POST /v1/model/{modelSlug} Send a prompt, receive a reply

Request body (JSON)

FieldTypeRequiredDescription
messagestringYes*The prompt / user message to send to the model.
promptstringYes*Alias for message.

* Either message or prompt is required.

Example request

curl -X POST \
  "https://codercopilot.firesmasher.workers.dev/v1/model/orbus-low?apikey=dak_your_key" \
  -H "Content-Type: application/json" \
  -d '{"message": "What is a Cloudflare Worker?"}'

Example response (200 OK)

{
  "ok": true,
  "model": "orbus-low",
  "reply": "A Cloudflare Worker is a serverless JavaScript runtime…",
  "usage": {
    "tokensConsumed": 47,
    "tokensUsed": 47,
    "tokensRemaining": 1453,
    "tokensLimit": 1500
  }
}

Error responses

StatusErrorMeaning
401Invalid API keyKey is missing, wrong, or revoked.
400Missing 'message'No prompt was provided in the request body.
404Unknown modelThe model slug in the URL doesn't exist.
429Rate limit / Token limitYou've hit the per-minute message limit or exhausted your token budget. Check retryIn / resetInMinutes in the response.
502AI errorThe upstream AI provider returned an error.

GET /v1/models

GET /v1/models List all available models (no auth required)

Example response

{
  "models": [
    { "slug": "flux-plus",     "tokenLimit": 200,  "resetHours": 12, "msgsPerMinute": 2 },
    { "slug": "orbus-low",     "tokenLimit": 1500, "resetHours": 12, "msgsPerMinute": 2 },
    { "slug": "nova-standard", "tokenLimit": 500,  "resetHours": 12, "msgsPerMinute": 2 }
  ]
}

Key Management Endpoints

These endpoints require a valid session cookie (you must be logged in via the main Coder Copilot app), not an API key.

GET /api/dev/keys List your API keys
POST /api/dev/keys Create a new API key (body: { "label": "…" })
DELETE /api/dev/keys/:keyId Revoke an API key
GET /api/dev/usage Get token usage for all your keys

Rate Limits

LimitValueScope
Messages2 per minutePer API key, per model
Tokens (flux-plus)200 / 12 hoursPer API key
Tokens (orbus-low)1500 / 12 hoursPer API key
Tokens (nova-standard)500 / 12 hoursPer API key
API keys3 per accountPer user

When you hit a limit, the API returns HTTP 429 with retryIn (seconds, for message limit) or resetInMinutes (for token limit) in the response body.

Quick Start

JavaScript / fetch

const res = await fetch(
  "https://codercopilot.firesmasher.workers.dev/v1/model/orbus-low?apikey=dak_your_key",
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({ message: "Hello, what can you help me with?" }),
  }
);
const data = await res.json();
console.log(data.reply);       // AI response text
console.log(data.usage);       // token consumption details

Python

import requests

res = requests.post(
    "https://codercopilot.firesmasher.workers.dev/v1/model/orbus-low",
    params={"apikey": "dak_your_key"},
    json={"message": "Hello, what can you help me with?"}
)
data = res.json()
print(data["reply"])
print(data["usage"])