Skip to Content

Automation and output

Set PRETERNATURAL_MODEM_ADMIN_API_KEY through your CI secret store, then select the intended target:

modem-cli --environment production projects list > projects.json

The environment key overrides the stored credential and is not saved. It is sent to whichever target you selected. There is no secret-valued API key flag; do not put a secret in shell arguments or a checked-in script.

Input and confirmation

Secret inputs use piped stdin or a masked terminal prompt. auth login --with-token, account --credential-stdin and 1Password integration creation follow that pattern. --secret-reference is a reference, not a materialized key.

Destructive commands ask in a terminal or require --yes without one. Global --force has command-specific behavior: for duplicate subscription imports it adds another entry. It does not universally bypass deletion or restore confirmation.

modem-cli backups export --output ./backup.snapshot.json.gz modem-cli backups restore --input ./backup.snapshot.json.gz --yes

Secret-bearing export additionally requires deliberate --include-secrets and confirmation (--yes in automation). Export and restore each need that option separately to preserve and apply credentials. backups export --output - emits raw gzip bytes, not JSON. Do not pipe it through a JSON formatter. Restores can take ten minutes; a timeout does not establish that the mutation failed.

Output channels

Resource data goes to stdout, generally as JSON. Status, expiry warnings and errors go to stderr. auth status has a readable report by default and JSON with --json. Some commands deliberately output secrets, including auth token and relay creation; avoid collecting their stdout in ordinary logs.

A failure exits nonzero. Preserve the named target, request ID and error details for diagnosis. Do not blindly retry a mutation after a lost response. Read the resource to determine what completed.

Customer completions

modem-cli customers complete --project-id PROJECT_ID \ --customer-id CUSTOMER_ID --product-id PRODUCT_ID \ --provider openai --model MODEL_ID --prompt 'Hello'

The command obtains a customer session through the admin API, then sends the request through ordinary customer JWT gateway authentication. This also applies when the project is in Sandbox mode; it does not substitute the synthetic Sandbox-secret path.

Text streams to stdout by default. --no-stream waits for the complete result. --json emits NDJSON chunks while streaming; with --no-stream it emits one JSON result. --request request.json or --request - supplies a full OpenAI-compatible request instead of --model/--prompt.

modem-cli customers complete --project-id PROJECT_ID \ --customer-id CUSTOMER_ID --product-id PRODUCT_ID \ --provider openai --request ./request.json --json

Completions are not automatically retried. Ctrl-C cancels the active request, but provider work already accepted can still consume allowance. Distinguish a confirmed pre-generation refusal from an interrupted stream or a network failure with an unknown outcome.

Log streams provide project-tagged NDJSON and in-memory reconnection cursors; the CLI does not persist a complete log archive across restarts.

Last updated on