Bailian CLI asynchronous Batch inference: convert CSV to JSONL, create jobs, track progress, cancel, and download results.
Manage asynchronous Batch inference from the terminal: convert CSV to JSONL, create Chat or Embedding batch jobs, track progress, cancel jobs, and download results and error files.
Convert CSV to Batch JSONL locally. No authentication required.
Usage
Example: Convert CSV to Chat JSONL
Example: Convert Embedding input with shared body defaults
The CSV must contain at least
Example Chat JSONL output:
Upload or reference input and create an asynchronous Batch job. Requires API Key authentication.
Usage
Example: Preview job creation
Example: Create a job with a 7-day completion window from an OSS file
Get Batch job details and optionally follow progress. Requires API Key authentication.
Usage
Example: Follow a job to a terminal state
List Batch jobs one page at a time. Requires API Key authentication.
Usage
Example: List completed and failed jobs
Request cancellation of a Batch job. Requires API Key authentication.
Usage
Example: Request cancellation
Download original results or error files, optionally generating CSV. Requires API Key authentication.
Usage
Example: Download results and generate CSV
Asynchronous Batch jobs differ from
bl text chat --batch. --batch sends one synchronous request; the commands on this page manage file-based asynchronous jobs. For local-file batch inference, use bl batch create with bl batch get / bl batch download.Command reference
bl batch convert
Convert CSV to Batch JSONL locally. No authentication required.
Usage
| Parameter | Type | Required | Description |
|---|---|---|---|
--file <csv> | string | yes | UTF-8 CSV with headers |
--output-file <jsonl> | string | yes | Local JSONL output path |
--model <model> | string | yes | Model for every record |
--id-column <name> | string | no | ID column (default: custom_id) |
--input-column <name> | string | no | Input column (default: content) |
--system <text> | string | no | Shared system prompt (Chat only) |
--body-file <json> | string | no | Shared body parameters, excluding model, messages, and input |
--endpoint <path> | string | no | Batch endpoint: /v1/chat/completions, /v1/embeddings, or /v1/chat/ds-test; defaults to /v1/chat/completions, and embedding input requires /v1/embeddings |
--force | switch | no | Replace existing output files (atomic per file) |
custom_id and content:
- Only text and Embedding field mapping is supported. Write native JSONL for multimodal or multi-turn input.
- IDs remain strings. Set the ID column to text in spreadsheet software to keep leading zeros.
--dry-runmakes no business API calls and writes no business files.
bl batch create
Upload or reference input and create an asynchronous Batch job. Requires API Key authentication.
Usage
| Parameter | Type | Required | Description |
|---|---|---|---|
--file <jsonl> | string | no | Local Batch JSONL; mutually exclusive with --input-file-id |
--input-file-id <source> | string | no | File ID, OSS HTTPS URL, or oss:region:bucket/path |
--completion-window <24h|7d> | string | no | Completion window, 24–336 hours (default: 24h) |
--name <text> | string | no | Job name (max 100 characters) |
--description <text> | string | no | Job description (max 200 characters) |
--callback-url <url> | string | no | Completion callback URL (documented for Beijing only) |
--metadata <KEY=VALUE> | array | no | Custom job metadata (repeatable) |
--endpoint <path> | string | no | Batch endpoint: /v1/chat/completions, /v1/embeddings, or /v1/chat/ds-test; inferred from local JSONL by default, and required with --input-file-id |
- Local input is limited to 50,000 requests, 500 MiB, and 6 MiB per line;
batch-test-modelis limited to 100 requests and 1 MiB. The CLI warns when a line exceeds 1 MiB because documentation limits conflict. - Remote references must be authorized and the URL must remain valid. The CLI does not download remote files for validation.
- A failed create does not replay the POST or clean up uploaded input files.
--dry-runmakes no business API calls and writes no business files.
bl batch get
Get Batch job details and optionally follow progress. Requires API Key authentication.
Usage
| Parameter | Type | Required | Description |
|---|---|---|---|
--batch-id <id> | string | yes | Batch job ID |
--follow | switch | no | Poll until a terminal state; Ctrl-C stops only local polling |
--interval <seconds> | number | no | Query interval, minimum 60 seconds (default: 65; --follow only) |
--poll-timeout <seconds> | number | no | Total polling budget (default: unlimited; --follow only) |
- A single query exits 0 after a successful request regardless of job state.
--followexits 0 for completed (results may still contain failed rows), 1 for failed, expired, or cancelled, 5 on client timeout, and 130 on Ctrl-C.finalizingandcancellingare not terminal. Progress goes to stderr; the final result goes to stdout.- Only transport errors, timeouts, and HTTP 429/5xx are retried, up to 3 times. The service retains results for a limited time; download them promptly.
bl batch list
List Batch jobs one page at a time. Requires API Key authentication.
Usage
| Parameter | Type | Required | Description |
|---|---|---|---|
--limit <n> | number | no | Page size, 1–100 (default: 20) |
--after <id> | string | no | Previous page last_id |
--name <text> | string | no | Filter by job name |
--input-file-id <id> | array | no | Filter by input file (repeatable, max 20) |
--status <status> | array | no | Filter by job status (repeatable): validating, in_progress, finalizing, completed, failed, expired, cancelling, cancelled |
--created-after <yyyyMMddHHmmss> | string | no | Created after this API timestamp |
--created-before <yyyyMMddHHmmss> | string | no | Created before this API timestamp |
- Returns
data,last_id, andhas_more; passlast_idto--afterfor the next page. - API timestamps are not timezone-converted.
bl batch cancel
Request cancellation of a Batch job. Requires API Key authentication.
Usage
| Parameter | Type | Required | Description |
|---|---|---|---|
--batch-id <id> | string | yes | Batch job ID |
- An accepted cancellation may return
cancelling, notcancelled; usebl batch get --followto confirm. - Already executed requests still incur charges, and input and output files are not deleted.
bl batch download
Download original results or error files, optionally generating CSV. Requires API Key authentication.
Usage
| Parameter | Type | Required | Description |
|---|---|---|---|
--batch-id <id> | string | yes | Batch job ID |
--out-dir <path> | string | no | Output directory (default: ./batch-results/<batch-id>/) |
--csv | switch | no | Also generate result.csv (lossy display projection) |
--force | switch | no | Replace existing output files (atomic per file) |
- JSONL is authoritative. CSV reads only
choices[0].message.content, Embedding data,response.request_id/status_code, usage, anderror.code/error.message; tool calls and additional choices are omitted. - CSV escapes formula-like text. Set the ID column to text in spreadsheet software to keep leading zeros.
- Results are not guaranteed to preserve input order. Writes are atomic per file, not per directory; if CSV generation fails, downloaded JSONL is kept and
--forcecan retry. - The service retains results for a limited time; download them promptly after the job completes.