Tutorial covering the @devspeak/cli npm package: global installation, API key authentication via devspeak login, translating text from arguments or stdin, attaching local PDF and Markdown context with --file, and wiring the CLI into a CI pipeline using the DEVSPEAK_API_KEY environment variable.

Automate Specifications with the DevSpeak CLI

The DevSpeak CLI exposes the same translation engine as the web app, which makes it usable from a terminal, a shell script, or a CI job. This tutorial covers installation through a working CI step.

What You'll Learn

  • Install and authenticate the CLI
  • Translate text from arguments, stdin, and local files
  • Run the CLI non-interactively in CI
  • Prerequisites

  • Node.js 18 or newer
  • A DevSpeak API key from Account Settings → Keys & Providers. Every plan can create one: FREE and VIBECODER include one key and 50 API requests a month on the default model; DEVELOPER and above have no monthly request limit
  • Time Estimate

    ~8 minutes

    Step 1 — Install

    ``bash

    npm install -g @devspeak/cli

    `

    Verify the install:

    `bash

    devspeak --version

    `

    Step 2 — Authenticate

    `bash

    devspeak login

    `

    The key is written to $XDG_CONFIG_HOME/devspeak/config.json with mode 600. Confirm it registered:

    `bash

    devspeak whoami

    `

    The output masks the key. It never prints in full, which makes whoami safe to run in a shared terminal.

    Checkpoint

    At this point you should have:

  • [ ] devspeak --version printing a version number
  • [ ] devspeak whoami reporting a masked key and an endpoint
  • If whoami fails, run devspeak doctor for a full environment audit.

    Step 3 — Translate

    Three input paths are available. All three hit POST /api/v1/translate.

    `bash

    Positional argument

    devspeak translate "Users should be able to export their data as CSV"

    Piped from stdin

    cat notes.txt | devspeak translate --format "Jira Tickets"

    With local file context

    devspeak translate "Implement the auth flow" --file ./docs/prd.pdf

    `

    --file accepts PDF, Markdown, and plain text. Each file can be up to 10 MiB, but one request carries at most about 3.1 MB of attachments in total — that total is the limit you will actually hit. From CLI version 1.5.2, the CLI checks locally, before any network call, that the file is non-empty, a supported type, and within that 3.1 MB total, so those failures are immediate. Older versions only checked for 10 MB, so a larger file got through and the API then rejected it. If devspeak --version reports a version below 1.5.2, upgrade with npm install -g @devspeak/cli.

    Step 4 — Run It in CI

    devspeak login is interactive and will hang in a CI runner. Use the environment variable instead — it takes precedence over any stored key.

    `yaml

  • name: Generate specification
  • env:

    DEVSPEAK_API_KEY: ${{ secrets.DEVSPEAK_API_KEY }}

    run: |

    devspeak translate "$(cat request.txt)" \

    --audience "Senior Dev" \

    --format "Technical Spec" > spec.md

    `

    Because documents go to stdout and diagnostics go to stderr, the redirect above captures only the specification.

    Troubleshooting

    command not found: devspeak

    The global npm bin directory is not on your PATH. Run npm prefix -g, add its bin subdirectory to your PATH, or invoke the CLI with npx @devspeak/cli. command -v devspeak shows which binary your shell resolves.

    401 Unauthorized in CI but not locally

    The runner is reading a different key. DEVSPEAK_API_KEY overrides the config file, so check the secret is exposed to the step and not just the workflow.

    Invalid value for --audience

    Audience, context, format, and tone are validated locally against the same enums the API enforces. Run devspeak translate --help for the accepted values.

    Summary

    You've learned how to:

  • Install and authenticate the CLI
  • Translate from arguments, stdin, and local files
  • Invoke the CLI non-interactively from CI
  • Next Steps

  • Read the [API reference](/docs/api-reference) for direct HTTP access
  • Add devspeak doctor --json` as a pipeline preflight check