--- title: Control Plane Operations --- # Control Plane Operations This guide covers day-2 admin workflows backed by control-plane endpoints: workers, tokenizers, WASM modules, parser utilities, and cache/load operations.
#### Before you begin - Completed [Control Plane Auth](control-plane-auth.md) - Set an admin bearer token (JWT or API key), for example: `export ADMIN_TOKEN=super-secret-key`
--- ## Auth Header Use the same header for all control-plane calls: ```bash -H "Authorization: Bearer ${ADMIN_TOKEN}" ``` Control-plane middleware checks the role against the method: the `GET` calls in this guide (listing and inspecting workers, tokenizers, and WASM modules) accept an `admin`- or `user`-role credential, and every other method, including the `POST` parser utilities, requires the admin role. The two routes in [Configuration View and Key Reload](#6-configuration-view-and-key-reload) are stricter: they require the admin role for the `GET` too. Without control-plane auth configured, use the shared `--api-key` as `ADMIN_TOKEN`; see [Without Control Plane Auth](control-plane-auth.md#without-control-plane-auth). --- ## 1. Worker Management Create worker: ```bash curl http://localhost:30000/workers \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -d '{ "url": "grpc://localhost:50051", "models": [{ "id": "meta-llama/Llama-3.1-8B-Instruct" }], "worker_type": "regular", "runtime": "sglang" }' ``` List workers: ```bash curl http://localhost:30000/workers \ -H "Authorization: Bearer ${ADMIN_TOKEN}" ``` Get worker by ID: ```bash curl http://localhost:30000/workers/ \ -H "Authorization: Bearer ${ADMIN_TOKEN}" ``` Patch worker (partial update — only the fields you specify change): ```bash curl -X PATCH http://localhost:30000/workers/ \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -d '{"priority": 100}' ``` `PUT /workers/` replaces the worker with a full `WorkerSpec` (including the original `url`) and re-runs the registration workflow. Use `PATCH` when you only need to change a few fields like `priority`, `cost`, `labels`, `api_key`, or `health`. Delete worker: ```bash curl -X DELETE http://localhost:30000/workers/ \ -H "Authorization: Bearer ${ADMIN_TOKEN}" ``` --- ## 2. Tokenizer Registry Add tokenizer: ```bash curl -X POST http://localhost:30000/v1/tokenizers \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -d '{ "name": "llama3-main", "source": "meta-llama/Llama-3.1-8B-Instruct" }' ``` List/get/status/delete: ```bash curl http://localhost:30000/v1/tokenizers \ -H "Authorization: Bearer ${ADMIN_TOKEN}" curl http://localhost:30000/v1/tokenizers/ \ -H "Authorization: Bearer ${ADMIN_TOKEN}" curl http://localhost:30000/v1/tokenizers//status \ -H "Authorization: Bearer ${ADMIN_TOKEN}" curl -X DELETE http://localhost:30000/v1/tokenizers/ \ -H "Authorization: Bearer ${ADMIN_TOKEN}" ``` --- ## 3. WASM Module Management Enable WASM support at startup: ```bash smg launch \ --worker-urls http://worker:8000 \ --enable-wasm ``` Register module: ```bash curl -X POST http://localhost:30000/wasm \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -d '{ "modules": [ { "name": "audit-middleware", "file_path": "/opt/wasm/audit.wasm", "module_type": "Middleware", "attach_points": [{"Middleware":"OnRequest"}] } ] }' ``` List/remove modules: ```bash curl http://localhost:30000/wasm \ -H "Authorization: Bearer ${ADMIN_TOKEN}" curl -X DELETE http://localhost:30000/wasm/ \ -H "Authorization: Bearer ${ADMIN_TOKEN}" ``` --- ## 4. Parser Utilities Function call parsing: ```bash curl -X POST http://localhost:30000/parse/function_call \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -d '{ "text": "{\"name\":\"get_weather\",\"arguments\":{\"city\":\"SF\"}}", "tool_call_parser": "json", "tools": [] }' ``` Reasoning separation: ```bash curl -X POST http://localhost:30000/parse/reasoning \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${ADMIN_TOKEN}" \ -d '{ "text": "internalanswer", "reasoning_parser": "deepseek_r1" }' ``` --- ## 5. Cache and Load Operations Flush worker KV caches: ```bash curl -X POST http://localhost:30000/flush_cache \ -H "Authorization: Bearer ${ADMIN_TOKEN}" ``` Inspect engine load. `/loads` is a public route, so it needs no auth header. Add `?model=` to limit it to one model's workers: ```bash curl http://localhost:30000/loads ``` The answer comes from the gateway's cached load snapshot, so no request reaches a worker. `/get_loads` is a deprecated alias that still requires control-plane auth. See [Get Loads](../reference/api/admin.md#get-loads) for the response fields. --- ## 6. Configuration View and Key Reload These two routes are mounted only when control-plane auth is configured; without it the paths answer `404`, so the shared `--api-key` fallback never reaches them. Both require the admin role, the `GET` included. Read the effective configuration, with every secret redacted and the API keys in force named by fingerprint: ```bash curl http://localhost:30000/config \ -H "Authorization: Bearer ${ADMIN_TOKEN}" ``` Re-read the key files given at startup (`--api-key-file`, `--tenant-api-keys-file`, `--control-plane-api-keys-file`) and put their keys in force, so a mounted secret rotated in place takes effect without a restart: ```bash curl -X POST http://localhost:30000/secrets/reload \ -H "Authorization: Bearer ${ADMIN_TOKEN}" ``` A key given as a flag or environment value stays as the start read it; only keys read from files reload. The answer is `200` with the files read and whether each key set changed, `409` when no key came from a file at start, or `422` when a file cannot be used — every set then stands as it was, and the error names the file, never its content. To apply rotations without calling the endpoint, start with `--secrets-auto-reload`, which watches the key files and puts a changed file's keys in force on its own. --- ## Next Steps - [Admin API Reference](../reference/api/admin.md) - [Extension API Reference](../reference/api/extensions.md) - [Configuration Reference](../reference/configuration.md#control-plane-authentication)