🧠 Cortex Community API Reference

Multi-provider AI Gateway API Documentation

Base URL

http://localhost:4000/api

Endpoints

POST /chat

Send chat completion requests with streaming support

Request Body:

{
        "messages": [
          {"role": "user", "content": "Hello!"}
        ],
        "stream": true,
        "model": "gpt-4",
        "temperature": 0.7,
        "max_tokens": 1000
      }

Example:

curl -X POST http://localhost:4000/api/chat \
        -H "Content-Type: application/json" \
        -d '{
          "messages": [{"role": "user", "content": "Hello!"}],
          "stream": false
        }'

POST /completions

OpenAI-compatible completions endpoint

Example:

curl -X POST http://localhost:4000/api/completions \
        -H "Content-Type: application/json" \
        -d '{
          "messages": [{"role": "user", "content": "Write a haiku"}],
          "model": "any"
        }'

GET /health

Basic health check

Example:

curl http://localhost:4000/api/health

GET /health/workers

Detailed worker status

Example:

curl http://localhost:4000/api/health/workers

GET /stats

Usage statistics

Example:

curl http://localhost:4000/api/stats

GET /stats/providers

Per-provider statistics

Example:

curl http://localhost:4000/api/stats/providers