On this page & docs navigation

One terminal, three channels

The client turns this machine's printers into a callable service. On-demand calls go over REST, batches and real-time notifications over the long-lived connection, and cross-network scheduling over the remote channel.

  • The command allowlist is served dynamically by /api/commands
  • Every channel returns the same Result structure
  • No language wrapper required
Colourful program code displayed on a screen
Your system calls the local service from any language; the client takes care of handing commands to the printer

Three real delivery channels

① REST

/api/command The general endpoint plus convenience endpoints, with JSON requests and responses. Built for on-demand calls from business systems.

② WebSocket

Native /ws(same port as REST), with the same message body as REST and broadcast support for queue changes. Built for long-lived connections and batch sending.

③ Terminal remote channel

The terminal connects out to the cloud service on its own, with jobs routed by device. Built for cross-network and mobile printing where there is no public inbound port.

REST endpoints (real)

The endpoints below are genuinely provided by the client's local service on default port 19861, adjustable in settings.

EndpointDescription
GET /api/commandsCommand allowlist (dynamic; returns the available cmd list)
POST /api/commandGeneral command endpoint: the body is JSON, cmd names the command, and the remaining fields are print parameters; when cmd is omitted, auto detection kicks in and the Result JSON passes through
POST /api/mcpBuilt-in MCP endpoint: JSON-RPC (initialize / tools/list / tools/call) so any MCP client can discover and call the print tool
GET /api/agent-toolsAgent integration manifest: MCP tool definitions and LLM function-calling definitions, machine-readable
GET /api/statusService status
GET /api/printers打印机列表(GetPrinterList),返回历史 printers / primary / detail / source 字段,并在 detail 中新增打印机指纹 fingerprint
GET /api/queuePrint queue (GetQueue)
GET /api/diskDisk info (GetDiskInfo)
GET /api/machine本机指纹(GetMachineFingerprint),可结合打印机列表里的 machineId 做设备对账
GET /api/update/checkCheck for updates (CheckUpdate)
POST /api/update/applyApply update (ApplyUpdate)
POST /api/printQueue a print job (QueuePrint)
POST /api/barcodePrint a barcode directly (PrintBarcode)
POST /api/print/topdfVirtual print to PDF (PrintToPdf)
POST /api/print/toxpsVirtual print to XPS (PrintToXps)
POST /api/escposESC/POS raw thermal printing (PrintEscPos)
POST /api/clean/scanDisk scan (ScanDisk)

Commands & parameters

The general endpoint body is a single JSON object: cmd names the command, and the remaining fields are print parameters; the command allowlist comes from /api/commands dynamically.

// General endpoint body = { "cmd": command name, remaining fields are command JSON parameters }
POST /api/command
{
  "cmd": "TemplatePrint",
  "html": "<div>Recipient: {{name}}</div>",  // template HTML ({{name}} is a template variable)
  "data": { "name": "Li" },          // template data (fills the template variables)
  "printer": "POSTEK 2108",
  "paperKind": "100x150"
}

// Convenience endpoints are equivalent but omit cmd:
POST /api/escpos   body = { "printer":"EPSON TM-T82III", "text":"Litchio receipt sample" }
POST /api/print    body = { "target":"D:/handouts/chapter-1.pdf", "copies":3 }

// Omitting cmd = default auto: content and file form are detected automatically
POST /api/command  body = {
  "target": "https://files.example.com/orders/waybill?id=8891",
  "copies": 2, "duplex": "duplexlong", "color": "monochrome"
}
What all 73 commands do and their parameters → Grouped into 8 categories including print execution, queue scheduling and printer management, with keyword filtering

Print parameters & auto detection

A print job can carry every common setting at once — or you can omit cmd and let the client detect the content and file form automatically, then choose the right print method. Every parameter below is genuinely parsed by the client's local service.

Layout & copies

orientation(default portrait), copies(default 1), paperKind, fit(default fit), margin(default 50).

Output options

duplex(default simplex), color(default: follow the printer), collate(default true), bin, pageOrder.

Network files

url / path are printed directly; the type is detected from the response file name, Content-Type and file-header signature.

Default auto

/api/command with cmd omitted follows AutoPrint , returning data.auto to describe what was recognised.

For the full parameter list, defaults and scope, see Print parameters & defaults; for the business background, see Print from a link.

WebSocket /ws (real)

// Native WebSocket, sharing the same port as REST
ws://127.0.0.1:19861/ws

// After connecting, the server first replies with a connect message; then send command JSON:
→  { "cmd": "TemplatePrint", "html":"<div>Recipient: {{name}}</div>", "data":{"name":"Zhang Wei"} }
←  { "code":200, "error":"success", "data":{} }   // Result structure
// Queue changes and the like are broadcast by the server (triggered via /api/command or /ws)

terminal remote channel

The terminal connects out to the cloud service on its own, with jobs routed by device to the right printer; local print capability is unchanged.

No public inbound port

The terminal initiates the connection, so you never have to open inbound ports for individual printers.

Routed by device

设备按机器指纹注册,显示名仅作辅助信息;任务按设备标识下发,多终端可并行分流。

Catch-up printing after a network drop

Local jobs queue while the internet is down and resume once the connection returns.

For the deployed form, see remote printing.

Let any agent drive printing

The client ships built-in agent endpoints:/api/mcp (the MCP endpoint) and /api/agent-tools (the tool & function-calling manifest). Any LLM agent, MCP client or workflow agent can plug right in; tool calls land on the print pipeline, equivalent to REST /api/command. Three generic patterns follow.

① REST call

Any agent that can send an HTTP request can POST print parameters straight to the local service; the input is the command arguments.

② MCP tool

The client's built-in /api/mcp endpoint lets MCP clients connect to discover and call the print tool directly.

③ Function / Tool

The client's /api/agent-tools serves LLM function-calling tool definitions that any agent / workflow framework can use.

// 由 MCP server 暴露的一个工具(本机打印助手)
{
  "name": "litchio_print",
  "description": "Print a file or content to a local printer",
  "inputSchema": {
    "type": "object",
    "properties": {
      "target":    { "type": "string", "description": "local path / url / inline content" },
      "printer":   { "type": "string" },
      "paperKind": { "type": "string" },
      "copies":    { "type": "number", "default": 1 }
    },
    "required": ["target"]
  }
}
// 通用 LLM function-calling 定义(执行时落到本机 REST /api/print)
{
  "name": "print_document",
  "description": "Silently print a file via the local print service",
  "parameters": {
    "type": "object",
    "properties": { "target": { "type": "string" }, "copies": { "type": "integer" } },
    "required": ["target"]
  }
}
// 智能体决定调用该工具后 → 落到本机服务(与 REST 端点等价)
POST http://127.0.0.1:19861/api/print
{
  "target": "C:/orders/2026-11-13.pdf",
  "printer": "EPSON TM-T82III",
  "copies": 2
}
← { "code": 200, "error": "success", "data": {} }

All of the above are caller-side integration patterns; for endpoints, command whitelist and response shape, refer to "REST endpoints" and "Commands & parameters" on this page.

Best practices

Check commands before calling

Call GET /api/commands for the current cmd allowlist so command names are never misspelled

General endpoint + convenience endpoints

High-frequency operations use the convenience endpoints (/api/print, /api/escpos); dynamic commands go through /api/command

Use the remote channel across networks

The terminal connects out on its own, so no public inbound port is needed; jobs queue locally when the network drops and catch up when it returns

Templates via direct URL

Host the template HTML at a reachable address and pass that URL in the body; the client downloads it and fills the template variables with your data

Idempotency and receipts

Check Result.code for the outcome; on failure read error — never assume success

Pass print parameters as needed

Orientation, copies, duplex, colour, paper and margins all have defaults — omit them and the defaults apply; see "Print parameters & defaults"

Runtime & license

These capabilities are genuinely provided by the local service embedded in the client — no separate web server to install, and no browser script wrapper either. Judge your integration against the facts below.

Embedded local service

starts automatically with the client, with no separate install or deployment; default port 19861; the listen address and port can be adjusted in the client settings.

One port

The any-device docs site, REST endpoints and native WebSocket /ws and /health share that port; the local service has CORS enabled.

No JS wrapper

The client ships no SDK or script; the examples on this page and in Multi-language integration all call the API directly with the language's own HTTP / WebSocket capabilities.

Open-source license

The desktop client is Mulan PSL v2 free and open source; the source archive and the full license text are both available.

Network boundary: The local service provides no access authentication: use it only on your own machine or a controlled intranet. The listen address and port can be adjusted in the client settings. To expose it to a LAN or the public internet, configure network isolation and firewall rules yourself — never leave the print API directly exposed on an untrusted network.