Skip to content

API Reference

All endpoints are served at http://<host>:<port>/. Training operations use a two-phase async protocol — see Launching & Configuration for details.

MethodPathDescription
POST/api/v1/forward_backwardForward + backward pass. Returns UntypedAPIFuture.
POST/api/v1/forwardForward pass only (no gradient). For eval or reference logprobs.
POST/api/v1/optim_stepApply gradients, clip, step optimizer and LR scheduler.
POST/api/v1/abort_gradient_epochDiscard one unmutated multi-adapter LoRA gradient epoch. Returns UntypedAPIFuture.
POST/api/v1/retrieve_futurePoll for async result by request_id.

Call POST /api/v1/abort_gradient_epoch when a forward_backward response is ambiguous (for example, the client lost the response) or when a client manually cancels an epoch before optim_step. The request follows the normal asynchronous protocol:

{
"model_id": "policy",
"seq_id": 42
}

The abort is whole-epoch, not per request: it discards every accumulated capture since the last successful optimizer step. It is idempotent while the epoch is still unmutated, so a client may safely repeat an ambiguous abort request before replaying the complete epoch.

An abort refuses a poisoned session or a session whose optimizer mutation is awaiting distributed publication. Those states cannot be repaired in-process. In particular, an ambiguous optim_step response may mean parameters or optimizer state already changed: restart from the last checkpoint. Never use abort_gradient_epoch to retry an ambiguous optimizer step.

MethodPathDescription
POST/api/v1/create_modelCreate and register a new training session. LoRA mode supports multi-tenant sessions; full-weight mode only supports the reserved model_id="default" session.
POST/api/v1/unload_modelUnload a session, freeing associated adapter state.
POST/api/v1/kill_sessionKill an active session. In LoRA mode, non-default tenant sessions are removed; in full-weight mode, the single active session is reset.
GET/api/v1/session_infoList active sessions and their state.
POST/api/v1/create_sessionCreate and register a Tinker-compatible session ID for follow-up calls.
POST/api/v1/session_heartbeatRefresh a session’s last-activity timestamp for idle cleanup.
MethodPathDescription
POST/api/v1/save_weightsSave DCP checkpoint. path: null = auto-timestamped.
POST/api/v1/load_weightsLoad DCP checkpoint and restore model weights + optimizer state.
POST/api/v1/list_checkpointsList available checkpoints under output_dir.
POST/api/v1/delete_checkpointDelete a checkpoint by ID.
POST/api/v1/weights_infoReturn checkpoint metadata for a model (used by xorl-client to load weights).
POST/api/v1/save_weights_for_samplerSave inference weights under sampler_weights/ (LoRA adapter or full HF checkpoint, depending on training mode).
GET/api/v1/training_runsList training runs.
MethodPathDescription
POST/add_inference_endpointRegister an SGLang inference server for weight sync.
POST/remove_inference_endpointUnregister an inference endpoint.
GET/list_inference_endpointsList all registered endpoints.
POST/api/v1/sync_inference_weightsTransfer current weights to registered inference endpoints using the configured backend.
POST/api/v1/set_sync_quantizationConfigure FP8 quantization for weight sync.
POST/api/v1/create_sampling_sessionLoad a LoRA adapter on inference server for sampling.
MethodPathDescription
GET/healthHealth check. Returns { "status": "healthy", "engine_running": bool }.
GET/api/v1/healthzTinker health check alias.
GET/Root info.
POST/sleepOffload model weights to CPU to free GPU memory.
POST/wake_upReload weights back to GPU after sleep.
  • ZORL and its REST routes were removed. Known ZORL configuration fields now fail with a migration error at YAML, --server.*, and session API boundaries; unrelated unknown fields retain their rolling-client/shared-config behavior.
  • Multi-adapter training accepts raw numerator losses only. Setting normalize_loss_before_backward rejects the forward_backward call; leave normalization to optim_step, which divides by the accumulated valid-token denominator exactly once.
  • A zero or non-finite global valid-token denominator is a hard, non-retryable data error. Repair the empty/invalid batch before beginning a new epoch.
  • Authoritative adapter clipping supports the L2 norm only. gradient_clip remains the scalar L2 threshold; other norm types are rejected.
FileDescription
src/xorl/server/api_server/endpoints.pyAll FastAPI endpoint handlers
src/xorl/server/api_server/api_types.pyPydantic request/response models