ServicesAI Services

OpenAI Chat Completions

Connect existing OpenAI-compatible clients through the adapter endpoint.

POST /v1/ai/chat/completions is an adapter around Downcity Model Protocol:

OpenAI request
  -> ModelCall
  -> AIService / AIChannel
  -> ModelStreamEvent
  -> OpenAI JSON or SSE
curl "$FEDERATION_URL/v1/ai/chat/completions" \
  -H "Authorization: Bearer $USER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [{"role":"user","content":"Hello"}],
    "stream": true
  }'

Messages, tools, tool choice, images, reasoning, usage, and finish reasons are converted into the same Downcity execution path. The endpoint is not a raw passthrough.