Back to chat
Covalid
API Docs
Sign in Register

API Reference

One endpoint. Send a prompt, get a response. Authenticate with your Client Key + Secret from your Profile.

Get your API keys →

Quick Start

curl -s -X POST /api/chat.php \
  -H "Content-Type: application/json" \
  -H "X-Client-Key: ck_YOUR_CLIENT_KEY" \
  -H "X-Client-Secret: cs_YOUR_CLIENT_SECRET" \
  -d '{
    "prompt": "Explain REST APIs in one sentence.",
    "model": "covalid-1.0"
  }'

Endpoint

POST /api/chat.php

Request Headers

HeaderRequiredDescription
Content-Type required Must be application/json
X-Client-Key required Your ck_… client key
X-Client-Secret required Your cs_… client secret

Request Body

FieldTypeRequiredDescription
prompt string required The message / question to send
model string optional Model name. Defaults to covalid-1.0.
Available: covalid-1.0 covalid-2.0

Response Fields

FieldTypeDescription
response string The model's reply
model string Model name that was used (e.g. covalid-2.0)
elapsed_ms number Wall-clock time in milliseconds
prompt_tokens number Tokens in the prompt
completion_tokensnumber Tokens in the response
total_tokens number Sum of prompt + completion
done boolean Always true (non-streaming)

HTTP Status Codes

StatusMeaning
200 Success
400 Missing or invalid prompt
401 Invalid or missing credentials
405 Non-POST request
502 Ollama unreachable or bad response
503 Server/proxy overloaded

Sample — 200 OK

{
  "response":          "REST stands for Representational State Transfer...",
  "model":             "covalid-1.0",
  "elapsed_ms":        1342,
  "done":              true,
  "prompt_tokens":     12,
  "completion_tokens": 38,
  "total_tokens":      50
}

Sample — 401 Unauthorized

{
  "error":         "Invalid client_key or client_secret.",
  "auth_required": true
}

Sample — 400 Bad Request

{
  "error": "Missing \"prompt\" in request body."
}

Live Tester

Send a real request right from this page. Sign in to pre-fill your credentials.