endpoints
Inference endpoints: hub-served inference for the skill / planner layer. The hub never serves the reflex layer. lucen serve claims an endpoint. A device consumes one only through a signed approval bound to device + model digest + endpoint id. On Lucen cloud the owner pays the tier's hourly rate while the endpoint runs. Sessions are metered, and carry no price.
GET / v1/ endpoints
List inference endpoints
Endpoints the caller may see: their own and those billed to an org they belong to. No endpoint is public. Newest first; an unknown owner or model_repo is an empty page, not a 404.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
status | query | EndpointStatus | |
executor | query | RunExecutor | |
model_repo | query | string | Only endpoints serving this |
owner | query | Handle | |
limit | query | integer | Page size. |
cursor | query | string | Opaque cursor from the previous page's |
Responses
| Status | Description | Body |
|---|---|---|
200 | Page of endpoints. | EndpointPage |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
422 | Request failed validation. | Problem |
POST / v1/ endpoints
Create an inference endpoint for a skill-layer model
A model repo becomes a hub-served inference endpoint. Inference placement is enforced here. The repo's ModelMeta.control_class must be skill or planner. A reflex model (a 50 Hz locomotion controller) answers 409. This hub serves nothing reflex-rate over a network. A model that has declared no class answers 422 asking for one.
The endpoint is pinned to one ONNX (onnx_path, or the repo's single root *.onnx) and its current sha256. A device approval request is pinned the same way. Every session's approval token is later bound to that sha256.
Or it is pinned to a checkpoint directory. A model with no ONNX export (the VLA smolvla_lora trains) is published as policy/ + lucen_manifest.json. The endpoint is then pinned to that directory and to its lucen-checkpoint-v1 digest (EndpointArtifact). The directory is named by policy_path, or auto-detected when the repo holds no root ONNX. Its control_class, contract fingerprint and params are read from the manifest, which the digest covers. A manifest that says reflex is 409, whatever ModelMeta says.
The hardware tier is chosen by the model's size. The caller does not pick it. The hub sizes the weights from the artifact itself when it can: the ONNX file's bytes, or the weight files under a checkpoint directory. It adds 20 % headroom for activations and picks the smallest tier that fits. A quantised file is sized as the bytes it holds. Some artifacts cannot be sized this way: a PEFT adapter, whose base weights live elsewhere, or a file too small to hold its declared parameters. For those the hub falls back to params × bytes per parameter. The dtype comes from the manifest's weights_dtype, bf16 otherwise. params comes from the repo's io_contract.json / manifest, else from the body. With no size at all the call answers 422. Endpoint.vram_basis says which rule applied.
Idle stop. A running endpoint with no open session for idle_stop_minutes is stopped by the hub, the way stopEndpoint stops it, and audited as endpoint.idle_stop. The default is 10 minutes on modal and never (0) on worker. keep_warm: true disables it. An open session always keeps the endpoint running. Separately, the server closes a session that requested no chunk for session_idle_seconds (default 300) with reason idle, so its metering ends.
executor: worker (the default) records the endpoint queued until lucen serve on the owner's own GPU box claims it. Such an endpoint is unpriced. executor: modal records the endpoint queued, and the hub spawns the deployed endpoint function on the tier's GPU. That function claims the endpoint with a public wss:// URL. On a deployment without MODAL_APP_NAME, executor: modal answers 503 naming that setting and records nothing. No fake running endpoint is created. key:train: an endpoint spends GPU time. Audited as endpoint.create.
What it costs. On Lucen cloud the owner pays the tier's hourly rate for the endpoint's uptime (cost_basis: uptime). That is every second from the server's claim to the stop, whether or not a robot has a session open. The hub refreshes cost_usd on every report and fixes it when the endpoint ends, cutting one ledger row for it. Sessions are metering detail and carry no price. budget_usd caps that uptime cost. The hub stops an idle endpoint after idle_stop_minutes, so an endpoint nobody uses does not run up a bill. A worker endpoint costs nothing.
Hosted execution. executor: modal serves only owners in the deployment's HOSTED_OWNERS (default lucen; * = everyone). Anyone else gets 403 with errors[].type: forbidden.hosted_owner, and nothing is recorded. The error names the setting and lucen serve. The estimate answers the same 403. Lucen cloud's policy server loads ONNX files only, so a checkpoint directory on executor: modal is 409 before anything is recorded or priced; serve it with executor: worker and lucen serve.
Request body
| Field | Type | Description |
|---|---|---|
model_repo | string |
|
onnx_path | FilePath | null | Which file in the repo the endpoint serves. Omit when the repo holds exactly one |
policy_path | FilePath | null | The checkpoint directory the endpoint serves, for a model with no ONNX export (a VLA). It uses LeRobot's |
executor | RunExecutor | null |
|
owner | Handle | null | Who the endpoint is billed to (user or org). Omit for yourself. |
name | string | null | A label for the endpoint page. |
params | integer | null | The model's parameter count. Used only when neither the repo's |
max_hours | number | null | A wall-clock cap the server enforces on itself; null means no cap. |
budget_usd | number | null | A hard cap on the endpoint's total cost (priced executors only). |
idle_stop_minutes | integer | null | Minutes with no open session after which the hub stops the endpoint. |
keep_warm | boolean | null |
|
session_idle_seconds | integer | null | The server closes a session that requested no chunk for this long, with reason |
Responses
| Status | Description | Body |
|---|---|---|
201 | Endpoint recorded ( | Endpoint |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
404 | Resource not found (or hidden from the caller). | Problem |
409 | State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...). | Problem |
422 | Request failed validation. | Problem |
429 | The account's spend cap is in | Problem |
503 | A service this endpoint needs is not configured in this deployment. The API boots with zero secrets. An endpoint that needs one says so instead of returning a stack trace. | Problem |
POST / v1/ endpoints/ estimate
Price an endpoint before creating it
Takes the same body as createEndpoint plus hours and validates it identically (visibility, kind, control class, size). It creates nothing. Answers the tier the model's size selects and rate_usd_per_hour × hours: what hours of uptime would cost. On Lucen cloud the rate accrues for every second the endpoint is up, with or without a robot connected. A worker endpoint is cost_usd_max: 0, priced: false. The hub bills nothing for the owner's own GPU. Zero means "not charged". It does not mean the GPU time is free. A modal estimate is priced at the tier's billed rate.
Hosted execution. executor: modal serves only owners in the deployment's HOSTED_OWNERS (default lucen; * = everyone). Anyone else gets 403 with errors[].type: forbidden.hosted_owner, and nothing is recorded. The error names the setting and lucen serve. The estimate answers the same 403. Lucen cloud's policy server loads ONNX files only, so a checkpoint directory on executor: modal is 409 before anything is recorded or priced; serve it with executor: worker and lucen serve.
Request body
| Field | Type | Description |
|---|---|---|
model_repo | string | |
onnx_path | FilePath | null | |
policy_path | FilePath | null | As on |
executor | RunExecutor | null | |
owner | Handle | null | |
params | integer | null | |
hours | number | How many hours to price; the endpoint itself has no fixed duration. |
budget_usd | number | null |
Responses
| Status | Description | Body |
|---|---|---|
200 | The estimate. | EndpointEstimate |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
404 | Resource not found (or hidden from the caller). | Problem |
409 | State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...). | Problem |
422 | Request failed validation. | Problem |
GET / v1/ endpoints/ {endpoint_id}
Get an inference endpoint
One endpoint with its live counters (open sessions, chunks served, GPU-seconds, service and round-trip p95) and what it has cost. cost_usd and billed_seconds are live while it runs: the claim to this instant at the tier's rate. Once it ended they are fixed. An endpoint the caller may not see is 404. The API does not answer 403 here, because that would confirm the endpoint exists.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
endpoint_id | path | Id | Endpoint id ( |
Responses
DELETE / v1/ endpoints/ {endpoint_id}
Stop an inference endpoint
A queued endpoint is stopped at once (nothing ran, nothing to bill). A running endpoint has a server behind it. So the hub sets stop_requested_at and answers 202 with the endpoint still running. lucen serve sees the flag on its next report, closes every session and reports stopped. Billing stops at that report: the endpoint's cost is fixed and its ledger row is written. Idempotent. A terminal endpoint is 409. key:train, like cancelRun. Audited as endpoint.stop. The hub takes the same path on its own for an endpoint idle past idle_stop_minutes (audited as endpoint.idle_stop) and for one whose uptime cost reached budget_usd. Endpoint.stop_reason says which it was.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
endpoint_id | path | Id | Endpoint id ( |
Responses
| Status | Description | Body |
|---|---|---|
202 | Stopped, or stop requested; the endpoint as it now stands. | Endpoint |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
404 | Resource not found (or hidden from the caller). | Problem |
409 | State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...). | Problem |
POST / v1/ endpoints/ {endpoint_id}/ claim
Claim a queued worker endpoint (`lucen serve` protocol)
The run protocol, mirrored: compare-and-set queued → running on an endpoint whose executor is worker. Exactly one caller wins. An endpoint already claimed, terminal, or not a worker endpoint answers 409. The server states the websocket URL devices will connect to and the sha256 of the file it loaded. That sha256 must equal the endpoint's model_sha256 (422 otherwise). A server serving bytes other than the ones approvals are bound to is refused before any device can reach it. Records claimed_by, the claiming credential, claimed_at, started_at and the first heartbeat_at. Only the claiming credential may reportEndpoint afterwards. Anyone else gets 409. Audited as endpoint.claim. key:train: the server spends the owner's GPU on the owner's behalf. On Lucen cloud the bill starts at claimed_at.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
endpoint_id | path | Id | Endpoint id ( |
Request body
| Field | Type | Description |
|---|---|---|
worker | string | A name for the server: its hostname, or anything the operator will recognise. |
url | string | The websocket URL devices connect to ( |
model_sha256 | Sha256 |
Responses
| Status | Description | Body |
|---|---|---|
200 | Claimed; the endpoint as it now stands. | Endpoint |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
404 | Resource not found (or hidden from the caller). | Problem |
409 | State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...). | Problem |
422 | Request failed validation. | Problem |
POST / v1/ endpoints/ {endpoint_id}/ report
Report sessions, metering and state for a claimed endpoint
The server's one write path after claimEndpoint, called every few seconds. The endpoint must be running (409 otherwise). The caller must be the credential that claimed it (409 otherwise). sessions[] carries the server's numbers per session:
- chunks served
- GPU-seconds attributed as wall time × 1 / concurrent open sessions. A shared inference GPU is split evenly across the sessions it served, and the row says so.
- service-time p50/p95
A session also carries state: closed when the device's link went away. The first close of a session wins. A session already closed keeps its closed_reason and closed_at. This report then only adds the server's numbers.
Every report refreshes heartbeat_at and the bill: on Lucen cloud cost_usd becomes the seconds since the claim at the tier's rate, whether or not a session is open. The report whose cost reaches budget_usd comes back with stop_requested_at set.
status: stopped | failed is terminal. Every still-open session is closed as metering detail (cost_usd 0, no ledger row). The endpoint's cost is fixed at that instant, its one ledger row is written, and endpoint.finish is audited with the cost. A worker endpoint's row is 0 / unpriced. Read stop_requested_at on the returned endpoint. When it is set, close every session and report stopped.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
endpoint_id | path | Id | Endpoint id ( |
Request body
| Field | Type | Description |
|---|---|---|
status | EndpointReportStatus | null | |
sessions | array of EndpointSessionState | |
error | string | null | |
log_chunk | string | null | The server's log since the last report; kept on the endpoint's last-report record only. |
stop_reason | EndpointServerStopReason | null | Why the server stopped on its own, sent with |
Responses
| Status | Description | Body |
|---|---|---|
200 | Recorded; the endpoint as it now stands. | Endpoint |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
404 | Resource not found (or hidden from the caller). | Problem |
409 | State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...). | Problem |
422 | Request failed validation. | Problem |
GET / v1/ endpoints/ {endpoint_id}/ sessions
List an endpoint's sessions (metering)
Newest first. Each session carries the server's metering (chunks served, GPU-seconds, service p50/p95). It also carries the device's own metering (chunks applied, round-trip p50/p95, deadline misses, degraded count). A session carries no price: the endpoint's uptime is what is billed. (An endpoint created before 16 October 2026 still prices each closed session.) status narrows to open or closed.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
endpoint_id | path | Id | Endpoint id ( |
status | query | EndpointSessionStatus | |
limit | query | integer | Page size. |
cursor | query | string | Opaque cursor from the previous page's |
Responses
| Status | Description | Body |
|---|---|---|
200 | Page of sessions. | EndpointSessionPage |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
404 | Resource not found (or hidden from the caller). | Problem |
422 | Request failed validation. | Problem |
POST / v1/ endpoints/ {endpoint_id}/ sessions
Open a session on an endpoint (a device, with a human's approval)
Invariant 2: an endpoint is consumed only through the consent layer. The caller is the robot-side driver (lucen-device, a write key that can see the device). It must present the EdDSA approval token a human minted with createApproval. The token must have been minted on a request that named this endpoint (ApprovalRequestCreate.endpoint_id). The hub verifies the token against its own signing key. It answers 403 in each of these cases:
- the token is missing, unsigned or expired
- the token is bound to another endpoint or another device
- the approval is no longer
issued/running
Every refusal gets the same answer, so a token cannot be probed. The hub then checks the token's onnx_sha256 against the endpoint's model_sha256. It answers 409 when the endpoint was re-created on other bytes. It also checks that a server has claimed the endpoint (409 while queued).
On success it records the session. It returns the server's websocket url plus a short-lived session token (EdDSA, typ: lucen-session+jwt, exp = min(approval exp, now + ENDPOINT_SESSION_TTL_S)). The device presents that token to the server as openpi's api_key header. The server verifies it offline against GET /v1/devices/signing-key. No hub API key can open a session without a signed approval. That is what this invariant guarantees. Audited as endpoint.session_open.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
endpoint_id | path | Id | Endpoint id ( |
Request body
| Field | Type | Description |
|---|---|---|
device_id | Id | |
approval_token | string | null | The EdDSA approval token a human minted for this device on a request naming this endpoint. Missing or invalid is |
Responses
| Status | Description | Body |
|---|---|---|
201 | Session opened; connect to | EndpointSessionOpened |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
404 | Resource not found (or hidden from the caller). | Problem |
409 | State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...). | Problem |
422 | Request failed validation. | Problem |
POST / v1/ endpoints/ {endpoint_id}/ sessions/ {session_id}/ report
The device's own metering for a session
Only the device can measure a round trip, so it reports its side. That covers chunks applied, round-trip p50/p95 in milliseconds and how many chunk deadlines were missed. It also covers how many times the local fail-safe fired (degraded_count). closed: true ends the session from the device's side. closed_reason says why: expired, local_cap, stopped, link_lost. The caller must be a credential that can see the session's device (404 otherwise). A session already closed by either side is 409: the first close wins. Each report replaces the device-side numbers. They are percentiles over the whole session. They are not deltas. key:write, like the driver's telemetry events.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
endpoint_id | path | Id | Endpoint id ( |
session_id | path | Id | Endpoint session id ( |
Request body
| Field | Type | Description |
|---|---|---|
chunks_applied | integer | null | |
rtt_ms_p50 | number | null | |
rtt_ms_p95 | number | null | |
deadline_misses | integer | null | |
degraded_count | integer | null | |
closed | boolean | |
closed_reason | string | null |
Responses
| Status | Description | Body |
|---|---|---|
200 | Recorded; the session as it now stands. | EndpointSession |
401 | Missing or invalid credentials. | Problem |
403 | Authenticated but not allowed (visibility, membership or scope). | Problem |
404 | Resource not found (or hidden from the caller). | Problem |
409 | State conflict (duplicate handle/slug, wrong repo kind, terminal job, ...). | Problem |
422 | Request failed validation. | Problem |
Schemas (15)
The schemas these operations reach before any other tag’s do. A type that links elsewhere is rendered on that tag’s page.
EndpointPage
| Field | Type | Description |
|---|---|---|
items | array of Endpoint | |
next_cursor | string | null |
EndpointCreate
| Field | Type | Description |
|---|---|---|
model_repo | string |
|
onnx_path | FilePath | null | Which file in the repo the endpoint serves. Omit when the repo holds exactly one |
policy_path | FilePath | null | The checkpoint directory the endpoint serves, for a model with no ONNX export (a VLA). It uses LeRobot's |
executor | RunExecutor | null |
|
owner | Handle | null | Who the endpoint is billed to (user or org). Omit for yourself. |
name | string | null | A label for the endpoint page. |
params | integer | null | The model's parameter count. Used only when neither the repo's |
max_hours | number | null | A wall-clock cap the server enforces on itself; null means no cap. |
budget_usd | number | null | A hard cap on the endpoint's total cost (priced executors only). |
idle_stop_minutes | integer | null | Minutes with no open session after which the hub stops the endpoint. |
keep_warm | boolean | null |
|
session_idle_seconds | integer | null | The server closes a session that requested no chunk for this long, with reason |
EndpointEstimateRequest
| Field | Type | Description |
|---|---|---|
model_repo | string | |
onnx_path | FilePath | null | |
policy_path | FilePath | null | As on |
executor | RunExecutor | null | |
owner | Handle | null | |
params | integer | null | |
hours | number | How many hours to price; the endpoint itself has no fixed duration. |
budget_usd | number | null |
EndpointEstimate
What an endpoint would cost, on the tier its model's size selects. On Lucen cloud the owner pays the tier's hourly rate for the endpoint's uptime, from the claim to the stop, whether or not a robot is connected. hours is how long it would stay up.
| Field | Type | Description |
|---|---|---|
executor | RunExecutor | |
tier | string | Selected from the model's size: |
params | integer | null | The parameter count the repo or the body declared. Null when neither did and the artifact's bytes sized the tier. |
basis | EndpointSizeBasis | |
weight_bytes | integer | The bytes the tier was sized from, before headroom: the ONNX file, the checkpoint directory's weight files, or |
bytes_per_param | number | null | With |
vram_bytes | integer |
|
rate_usd_per_hour | number | Billed hourly rate for the tier (4 decimal places); 0 for a |
hours | number | How long the endpoint would stay up. |
cost_usd_max | number |
|
budget_usd | number | null | |
capped_by_budget | boolean | |
priced | boolean | False when the hub does not bill the executor ( |
artifact | EndpointArtifact | |
notes | array of string | How the tier was sized, in sentences. The first note names the basis and the arithmetic. |
EndpointClaim
| Field | Type | Description |
|---|---|---|
worker | string | A name for the server: its hostname, or anything the operator will recognise. |
url | string | The websocket URL devices connect to ( |
model_sha256 | Sha256 |
EndpointReport
One progress or terminal report from the server. Every field is optional.
| Field | Type | Description |
|---|---|---|
status | EndpointReportStatus | null | |
sessions | array of EndpointSessionState | |
error | string | null | |
log_chunk | string | null | The server's log since the last report; kept on the endpoint's last-report record only. |
stop_reason | EndpointServerStopReason | null | Why the server stopped on its own, sent with |
EndpointSessionStatus
EndpointSessionPage
| Field | Type | Description |
|---|---|---|
items | array of EndpointSession | |
next_cursor | string | null |
EndpointSessionOpen
| Field | Type | Description |
|---|---|---|
device_id | Id | |
approval_token | string | null | The EdDSA approval token a human minted for this device on a request naming this endpoint. Missing or invalid is |
EndpointSessionOpened
| Field | Type | Description |
|---|---|---|
session | EndpointSession | |
url | string | The server's websocket URL. |
session_token | string | EdDSA JWT ( |
expires_at | string (date-time) | |
model_sha256 | Sha256 | |
contract_fingerprint | ContractFingerprint | null |
EndpointSessionReport
The device's side of a session's metering; each report replaces the last.
| Field | Type | Description |
|---|---|---|
chunks_applied | integer | null | |
rtt_ms_p50 | number | null | |
rtt_ms_p95 | number | null | |
deadline_misses | integer | null | |
degraded_count | integer | null | |
closed | boolean | |
closed_reason | string | null |
EndpointSession
| Field | Type | Description |
|---|---|---|
id | Id | |
endpoint_id | Id | |
device_id | Id | null | |
approval_id | Id | null | |
status | EndpointSessionStatus | |
opened_at | string (date-time) | |
expires_at | string (date-time) | null (date-time) | When the session token expires: the approval's expiry or the hub's session TTL, whichever is sooner. |
closed_at | string (date-time) | null (date-time) | |
closed_reason | string | null | |
last_report_at | string (date-time) | null (date-time) | |
chunks_served | integer | As the server reported. |
gpu_seconds | number | As the server attributed (wall × 1 / concurrent sessions). |
service_ms_p50 | number | null | |
service_ms_p95 | number | null | |
chunks_applied | integer | null | As the device reported. |
rtt_ms_p50 | number | null | |
rtt_ms_p95 | number | null | |
deadline_misses | integer | null | |
degraded_count | integer | null | How many times the device's local fail-safe fired (hold on deadline miss or link loss). |
cost_usd | number | null | 0 on an endpoint billed by |
priced | boolean | True only for a closed session on a priced endpoint billed by |
created_at | string (date-time) |
EndpointReportStatus
EndpointSessionState
The server's numbers for one session, replaced on every report.
| Field | Type | Description |
|---|---|---|
session_id | Id | |
state | string | |
chunks_served | integer | |
gpu_seconds | number | Wall time this session was open × 1 / the number of sessions open alongside it, summed per interval. |
service_ms_p50 | number | null | |
service_ms_p95 | number | null | |
closed_reason | string | null |
EndpointServerStopReason
Why a server stopped without being asked. max_hours: the endpoint's own time limit. max_seconds: the server's own --max-seconds. interrupted: the server process was told to stop. hub_unreachable: the hub stayed away longer than any session can live.