DXA Orchestration API
Model routing & declarative AI workflows
DXA Orchestration is the middleware layer that brings AI into existing core systems. Its API offers a model router with automatic fallback on Workers AI, and a workflow engine that runs declarative multi-step AI pipelines (with retry and idempotency). Fully Cloudflare-native — no external API keys required.
Base URL
Authentication
Endpoints are currently public (no sign-in), suitable for trials. Abuse protection is handled at the Cloudflare platform layer; the lead endpoint can enable Turnstile.
Model router
/api/route Route an inference request to a suitable model, with auto-fallback
Auth: None (public)
Body parameters
| Field | Type | Description |
|---|---|---|
prompt* | string | Prompt (≤600 chars) |
difficulty | 'fast' | 'balanced' | 'frontier' | Model tier (default `balanced`) |
Example request
curl -X POST 'https://orchestration.dxa.io.vn/api/route' \
-H 'Content-Type: application/json' \
-d '{ "prompt": "Tóm tắt hợp đồng này", "difficulty": "balanced" }' Example response
{
"ok": true,
"label": "AI cân bằng",
"model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
"latencyMs": 1234,
"answer": "…",
"hops": [
{ "model": "@cf/meta/llama-3.1-8b-instruct", "status": "error" },
{ "model": "@cf/meta/llama-3.3-70b-instruct-fp8-fast", "status": "ok" }
]
} Error codes
400 empty_prompt | Missing prompt |
502 all_failed | All models failed |
503 ai_unavailable | Workers AI not configured |
Workflow engine
/api/wf Run a declarative AI workflow (multi-step, idempotent)
Auth: None (public)
Body parameters
| Field | Type | Description |
|---|---|---|
workflow* | string | Registered workflow name, e.g. `support-triage` |
input* | object | Input data (e.g. `{ "message": "…" }`) |
idemKey | string | Idempotency key (≤120 chars) |
Example request
curl -X POST 'https://orchestration.dxa.io.vn/api/wf' \
-H 'Content-Type: application/json' \
-d '{ "workflow": "support-triage", "input": { "message": "Tôi chưa nhận được hóa đơn" } }' Example response
{
"ok": true,
"runId": "…",
"workflow": "support-triage",
"status": "done",
"steps": [
{ "id": "classify", "type": "ai", "status": "ok", "output": "Thanh toán" },
{ "id": "draft", "type": "ai", "status": "ok", "output": "Cảm ơn bạn…" },
{ "id": "record", "type": "connector", "status": "ok" }
],
"result": { "category": "Thanh toán", "reply": "Cảm ơn bạn…" }
} Error codes
400 unknown_workflow | Workflow not registered |
400 empty_input | Missing required input field |
/api/wf Fetch the status & steps of a workflow run
Auth: None (public)
Parameters
| Name | Type | Description |
|---|---|---|
id* | string | The runId returned when the workflow ran |
Example response
{
"ok": true,
"run": { "run_id": "…", "workflow": "support-triage", "status": "done" },
"steps": [ { "step_id": "classify", "status": "ok", "latency_ms": 234 } ]
} Error codes
404 not_found | Run not found |
Lead capture
/api/lead Capture a B2B lead from a form (optional newsletter opt-in)
Auth: None (public, optional Turnstile)
Body parameters
| Field | Type | Description |
|---|---|---|
name* | string | Full name |
email* | string | Business email |
company | string | Company |
tool | string | Tool context (default `orchestration`) |
Example response
{ "ok": true } Error codes
400 invalid | Missing/invalid name or email |
400 personal_email | Personal/disposable email blocked |