Docs

Developer Tools

Command Line

Command Line

Ask Aivana from your terminal with the aivana command. No code required.

The aivana command sends your question to the Aivana API and streams the answer into your terminal. It calls the same API as your application, with the same API key, so it's the quickest way to try Aivana, script it, or pipe files and command output straight in.

1

Install the CLI

Install it with Python or Node.js, whichever you already have. Both install the same aivana command, and it behaves identically either way.

pipx install aivana

Try it without installing

Run it once with uvx aivana "..." (Python 3.10+) or npx @aivana/cli "..." (Node.js 18+).

2

Set your API key

Create a key on the API Keys page, then put it in the AIVANA_API_KEY environment variable.

export AIVANA_API_KEY="your-aivana-api-key"

Why there's no --api-key flag

The key is read from the environment only. A key typed as a command-line argument is saved in your shell history and is visible to other users on the same machine.

3

Ask a question

bash
aivana "Should we migrate billing to DynamoDB?"
aivana "What's the default port for Postgres?" --effort low

The answer streams in as it's written. A progress line shows while Aivana works, but only the answer goes to standard output, so aivana "..." > answer.md saves just the answer.

Pipe in files and command output

Text piped in is sent ahead of your question, so you can hand Aivana a diff, a log or a document without copying and pasting.

bash
git diff | aivana "Review this change" --effort high
aivana "Summarize the three biggest risks" < contract.txt
aivana "What's driving the dip in this chart?" --image chart.png

The command's --image option attaches images: up to 5 per question, each a PNG, JPEG, WebP or GIF of up to 8 MB. The Aivana API itself also accepts PDF, Word and CSV files (see Files & Documents); from the command line, extract a document's text first and pipe that in.

Options

  • --effort auto | low | medium | high: a ceiling on how much intelligence Aivana may apply. auto, the default, lets Aivana judge from the question.
  • --shape: the answer format. One of auto, text, recommendation, summary, tradeoffs, decision or extract.
  • --web / --no-web: always, or never, search the web first. With neither, there is no search, the default for API keys. A question that searches is charged every token used to answer it, not just your question and the answer.
  • --system "...": your own instructions, such as a persona, tone or format.
  • --assistant-name NAME: the name the assistant presents as.
  • --max-tokens N: a ceiling on answer length. It can shorten an answer, never lengthen it.
  • --temperature T: from 0.0 to 2.0. Leave it off to let Aivana choose per question.
  • --image PATH: attach an image. Repeat it for up to 5.
  • --trace: show the Intelligence Trace, which explains how Aivana handled your question.
  • --json: wait for the whole response and print it as JSON, for scripts.
  • -q, --quiet: hide the progress line.

No model picker, on purpose

There is no option to choose a model or provider. Aivana decides which models answer each question, and --effort sets a ceiling on how much intelligence it may apply.

Exit codes

Scripts can tell what happened from the exit code, including whether a retry makes sense:

0    success
1    the request failed
2    bad usage
3    authentication problem: no key, or an invalid or expired one
4    rate limited: wait, then retry
5    out of credits: top up in AI Studio
6    temporary failure (network, timeout, upstream): safe to retry
130  interrupted (Ctrl-C)

Good to know

  • Quote your question. The shell acts on characters such as ?, * and ' before aivana sees them.
  • In scripts and CI jobs with nothing to pipe in, add < /dev/null. Otherwise aivana waits up to 3 seconds for piped input before answering.
  • Every run is a normal API call and uses credits, charged by tokens.
  • --effort low is useful for simpler questions and faster experimentation.
  • AIVANA_API_BASE points the command at a different Aivana environment.
  • aivana --help lists every option.

Learn more

Managing API Keys

Learn how to create and revoke API keys in Aivana AI Studio.

Create KeyView in Docs

Quickstart Guide

Establish environment, initiate clients, and issue trial calls.

Try the Playground

Experiment with Aivana MMI — no account or code required.

Still have questions? We are here to help!

Try live

Run chat interactively in the Playground without any setup.

On this page

Command LineInstall the CLISet your API keyAsk a questionPipe in files and command outputOptionsExit codesGood to know

Helpful links

aivana on PyPI@aivana/cli on npm

Was this helpful?

Still have questions? We are here to help!