The console and the API are the same surface. Anything you can click, you can call — with the same authorisation, metering and audit behind it.
Sign in to the console, open Settings → API keys and create a key. It is shown once. Then ask the gateway for a plan:
curl -X POST https://cloudai.webyne.com/api/v1/chat/completions \
-H "authorization: Bearer wby_..." \
-H "content-type: application/json" \
-d '{
"model": "webyne-max",
"stream": false,
"messages": [
{"role": "user", "content": "Build a CRM with Next.js, Node.js and PostgreSQL on Kubernetes"}
]
}'The reply contains an architecture, a data model, an API surface, a repository scaffold and a priced infrastructure plan. Turn it into a real project:
# 1. create the project
curl -X POST https://cloudai.webyne.com/api/v1/projects \
-H "authorization: Bearer wby_..." -H "content-type: application/json" \
-H "idempotency-key: $(uuidgen)" \
-d '{"name":"Acme CRM","description":"CRM for the sales team"}'
# 2. dispatch the supervisor
curl -X POST https://cloudai.webyne.com/api/v1/projects/$PROJECT/agent-runs \
-H "authorization: Bearer wby_..." -H "content-type: application/json" \
-H "idempotency-key: $(uuidgen)" \
-d '{"goal":"Build a CRM with Next.js, Node.js and PostgreSQL on Kubernetes"}'
# 3. watch it work
curl https://cloudai.webyne.com/api/v1/agent-runs/$RUN \
-H "authorization: Bearer wby_..."Machine calls use a bearer API key scoped to one tenant. Browser sessions use an HttpOnly cookie issued after password and TOTP verification. Both resolve to the same principal, and every request is bound to a tenant before it touches data.
The endpoint is OpenAI-compatible, so existing clients work. Request a model alias — webyne-fast, webyne-pro, webyne-max,webyne-code — and the router picks the version, handles health and fails over to a Webyne-hosted model if an external provider is unavailable. Streaming responses are server-sent events; the first frame reports which model actually served the request.
data: {"object":"chat.completion.route","model":"webyne-max","provider":"webyne","privacy":"local"}
data: {"object":"chat.completion.chunk","choices":[{"delta":{"content":"## Plan"}}]}
...
data: {"choices":[{"finish_reason":"stop"}],"usage":{"prompt_tokens":13,"completion_tokens":648},"ttft_ms":14}
data: [DONE]A project owns its repository, environments, builds, deployments and resources. An agent run is a checkpointed state machine: every step is written before the next one starts, so a run is resumable and fully auditable. Steps record the tool that was used and the risk the policy engine assigned to it.
The lifecycle is deliberate and cannot be short-circuited:
request → architecture plan → price estimate → IaC diff → policy check
→ approval → apply → health check → inventory → monitorPOST /v1/infrastructure/plans returns desired state, a monthly estimate and an OpenTofu diff, and provisions nothing. apply returns 409until the plan has been approved.
Preview and staging deploy on request. Production returns 428 together with the policy decision unless the call carries approved: true from a principal that holds the role and has satisfied MFA. Every deployment keeps a rollback reference.
| Method | Path | Description |
|---|---|---|
| POST | /v1/chat/completions | OpenAI-compatible completion. Set stream:true for SSE. |
| GET | /v1/models | Model aliases available to your tenant, with prices and context windows. |
| GET | /v1/projects | List projects. |
| POST | /v1/projects | Create a project and bootstrap its repository. |
| GET | /v1/projects/{id} | Project with files, commits, builds, deployments and resources. |
| GET | /v1/projects/{id}/files | List generated files, or read one with ?path=. |
| POST | /v1/projects/{id}/agent-runs | Dispatch the supervisor against a goal. |
| GET | /v1/agent-runs/{id} | Run state and every checkpointed step. |
| POST | /v1/builds | Run the build pipeline for a commit. |
| POST | /v1/deployments | Deploy to preview, staging or production. |
| GET | /v1/deployments | Deployment history. |
| POST | /v1/infrastructure/plans | Turn a request into desired state, a price and an IaC diff. |
| POST | /v1/infrastructure/plans/{id}/approve | Approve a plan. |
| POST | /v1/infrastructure/plans/{id}/apply | Apply an approved plan. |
| GET | /v1/resources | Inventory, filterable by ?category=. |
| GET | /v1/metrics | Platform or resource telemetry. |
| GET | /v1/logs | Log entries, filterable by level and trace id. |
| POST | /v1/remediations/{id}/approve | Approve and execute a proposed remediation. |
| GET | /v1/usage | Metered consumption and recurring spend. |
| GET | /v1/audit-events | The audit trail. |
| GET | /v1/api-keys | Manage machine credentials. |
Every mutation accepts an Idempotency-Key header. Replaying a key returns the stored response instead of performing the action twice — safe for retries and at-least-once queues.
Every response carries X-Trace-Id. The same id appears on the agent run, the build, the deployment, the log lines and the audit events, so one identifier connects a support question to the work that caused it.
{"error": {"message": "plan must be approved before apply", "status": 409, "detail": null}}401 unauthenticated · 403 role or step-up missing ·409 wrong state · 422 invalid body · 428 approval required, with the policy decision attached.