Skip to content

Get started

azrouter CLI

Install the azrouter command line, log in with your key, then chat with files, make images, videos and speech, embed text, call any endpoint, check prices, balance and usage, and teach your coding agents to use it.

azrouter is AZRouter's command line. It chats with any text model (with images, PDFs and other files attached), makes images, videos and speech, embeds text, calls any endpoint, lists the models on sale with their prices, and shows your balance and spend.

It calls the same API with your own key, and every request is billed the same way as from code. Every command prints --json for scripts and AI agents, and azrouter skills install teaches Claude Code, Codex, Cursor, Gemini CLI and OpenCode to use it.

It runs on macOS, Linux and Windows, on x86_64 and arm64.

1. Install

Shell
curl -fsSL https://azrouter.dev/install.sh | sh

The script installs the latest release as ~/.local/bin/azrouter, without sudo.

Windows: run this in PowerShell instead. It installs azrouter.exe in %LOCALAPPDATA%\Programs\azrouter, without administrator rights, and adds that folder to your PATH:

PowerShell
irm https://azrouter.dev/install.ps1 | iex

Before azrouter.dev serves either script, it checks the release's signature and writes the release's version and SHA-256 checksums into it. The download is installed only if its checksum matches.

The macOS and Linux script also adds az as a short name for azrouter, unless another az is already on your PATH. The Azure CLI is called az too: if it's installed, the script leaves it alone and you type azrouter.

If ~/.local/bin isn't on your PATH, the script prints the line to add. Add it, then open a new terminal.

2. Log in

Shell
azrouter login

Create a key in Dashboard → API keys and paste it when asked. The key doesn't show as you paste it.

azrouter checks the key before it saves it; the check generates and bills nothing. The key is saved in ~/.config/azrouter/config.json, readable by you only.

3. Check your balance and the models

Shell
azrouter balance
azrouter models

balance prints your balance in US dollars, such as $12.34.

models lists every model on sale with its price.

Commands

CommandWhat it does
azrouter chat "…"Asks a text model, with files attached, tools and JSON output
azrouter image "…"Makes one image and saves it
azrouter video "…"Makes one video, waits for it and saves it
azrouter speak "…"Turns text into speech and saves the audio
azrouter transcribe FILETurns speech into text
azrouter embed "…"Prints the text's embedding
azrouter api PATHCalls any endpoint with your key
azrouter modelsLists the models on sale with their prices
azrouter balancePrints your balance
azrouter usageShows your spend per day and model
azrouter keysSays which key it uses, and where keys are made
azrouter skills installTeaches your coding agents to use azrouter
azrouter updateInstalls the latest release

Every command takes --help for all of its flags, and --json for output a script can read.

A prompt can come from a file: @notes.md sends that file's text, and @- reads stdin. Write @@ to send text that starts with @.

-p key=value adds any other request field to chat, image, video, speak and embed, such as -p temperature=0.2. A value that reads as JSON is sent as JSON. key=@file sends a file: a .json file as its JSON, a text file as its text, anything else as a data: URL. --body @body.json adds several fields at once.

chat

Shell
azrouter chat "explain TCP slow start in 3 lines"

Prints the model's answer as it arrives. At a terminal, it first shows the model's price.

Without -m it asks openai/gpt-6-luna. Pass -m with any model ID from azrouter models, and -s for a system prompt.

Piped input is added to the prompt:

Shell
cat notes.md | azrouter chat "summarize this" -m qwen/qwen3.8-flash

-f attaches a file, and takes more than one:

Shell
azrouter chat "what is in these?" -f photo.jpg -f report.pdf

Images are sent as images, audio as audio, text and code as text, and PDFs and other files as files. The model must take that kind of input: azrouter models --json lists each model's input.

--response-format json asks for a JSON object, and --schema @schema.json for JSON that matches a JSON Schema.

--tools @tools.json sends an OpenAI tools array. The answer then comes in one piece: its text, then the model's tool calls as JSON. To send a tool's result back, put the whole conversation in --body @conversation.json as messages.

--max-tokens caps the answer, reasoning included: azrouter says so when the cap cut it. --no-stream prints it at the end, and --json prints one object: model, content, tool_calls, finish_reason, usage and price.

image

Shell
azrouter image "a red fox in snow" -o fox.png

Makes one image, saves it and prints its path.

For images on /v1/images/generations, use n: 1 and response_format: "b64_json" only: one whole PNG, baseline JPEG or WebP file, with no streaming or URL response. output_format and other values are refused with 400. Models that make images through chat use that model's chat options.

Without -o the file is azrouter-image-<date>-<time> in the current folder, with the image's own extension. A file that already exists is replaced only with --force.

Without -m it uses the lowest-priced image model on sale. --size WxH asks for a size, from a model that takes one.

Nano Banana 2 (google/gemini-3.1-flash-image) also takes up to 10 reference images, and Grok Imagine Image 2.0 (x-ai/grok-imagine-image-2.0) one of exactly 1:1, included in the per-image price. When Grok Imagine Image 2.0's backup provider serves the request, -i is refused with 400 and nothing is billed. Give each with -i FILE (or --image; repeat it, in order): a PNG, JPEG or WebP file, about 6 MB in all. They go to the API as images, a list of data: URLs. Without -m, one -i uses Grok Imagine Image 2.0 and more use Nano Banana 2. More than one -i needs CLI 1.1.14 (azrouter update gets it).

Shell
azrouter image "the same cube in a forest" -m google/gemini-3.1-flash-image -i ref.png -i style.png
azrouter image "the same cube in a forest" -m x-ai/grok-imagine-image-2.0 -i ref.png

Recraft's tools work on one image the same way: -m recraft/remove-background removes its background and -m recraft/crisp-upscale upscales it to twice its width and height. The prompt is required but not used.

Shell
azrouter image "remove the background" -m recraft/remove-background -i photo.png

GPT Image 2 (openai/gpt-image-2) accepts a size and quality. Other image models take no reference image; check each model's page for its supported options and prompt limit.

video

Shell
azrouter video "waves rolling onto a beach at sunset"

Starts one video, waits for it, saves it as azrouter-video-<date>-<time>.mp4 in the current folder and prints its path. -o names the file.

It waits up to 20 minutes; --timeout 30m changes that. A video is billed once it starts: if the wait ends, the connection breaks, a check or the download is refused, or you press Ctrl-C before it is saved, the command prints its job id and the exact azrouter video --resume line that saves it, without making another (CLI 1.1.12; on Windows the line is for PowerShell).

Without -m it uses the lowest-priced video model on sale. --seconds and --size ask for a length and a frame size: each video model's page on the models page says which ones it makes.

The models billed per video token, Seedance 2.0 and Seedance 2.0 mini, take their own flags:

Shell
azrouter video "a red fox runs through fresh snow" -m bytedance/seedance-2.0 --resolution 720p --ratio 16:9 --seconds 5
azrouter video "she turns and smiles" -m bytedance/seedance-2.0-mini --image frame.png --no-audio
  • --seconds N: 4 to 15 whole seconds (5 when left out).
  • --resolution: 480p, 720p or 1080p, as the model makes them (720p when left out).
  • --ratio: 21:9, 16:9, 4:3, 1:1, 3:4, 9:16, or adaptive for the first frame's shape (16:9 when left out, the first frame's with --image).
  • --image: a first frame, a PNG, JPEG or WebP file of up to 18 MB or an https:// URL.
  • --no-audio: a video without sound.

A flag left out stays out of the request, so the API's default applies. A value the model doesn't take is refused before anything is sent. At a terminal, the command shows what the video costs before it starts: its tokens at its resolution's price.

The models that work from an input video take --video (CLI 1.1.14):

Shell
azrouter video "she dances" -m kwaivgi/kling-v2.6-motion-control --video https://example.com/dance.mp4 --image person.png
azrouter video "make it snow" -m alibaba/wan-2.7 --video https://example.com/street.mp4
  • --video: the https:// URL of an MP4 file of at most 32 MB, longer than 4 and at most 5 seconds. It needs -m.
  • --image: the input image Kling's motion control models and Wan 2.2 Animate Move also need, a file or an https:// URL.
  • --seconds: 5 when left out.

speak

Shell
azrouter speak "Your parcel is out for delivery." -o parcel.mp3

Turns text into speech, saves the audio and prints its path. Long text goes in as @script.txt or on stdin.

Without -m it uses the lowest-priced text-to-speech model on sale (Eleven v4 Turbo today). Choose -m elevenlabs/eleven-v4 or -m elevenlabs/eleven-v4-turbo to use either newer voice model. Speech is billed per character. -v picks the voice by the model's own voice ID, and --format the audio format (mp3 by default).

transcribe

Shell
azrouter transcribe meeting.mp3

Prints what is said in an audio file. -l th names the language.

No speech-to-text model is on sale yet: until one is, the command says so and sends nothing.

embed

Shell
azrouter embed "The quick brown fox"

Prints the text's embedding as one JSON array of numbers, from the lowest-priced embedding model on sale (openai/text-embedding-3-large today).

--lines embeds each line of the input and prints one array per line, in order. --dimensions asks for a shorter vector. --json adds the model, the vector's length and the token count.

api

Shell
azrouter api /v1/models

Calls any endpoint with your key and prints the answer as it comes, a stream as it streams. Use it for a new endpoint, or a field the other commands have no flag for.

/v1/... paths go to https://api.azrouter.dev, and /api/... paths to https://azrouter.dev. Your key is sent to these two hosts only.

The method is GET, or POST when there is a body. -d sends a JSON body, inline, as @file.json, or @- from stdin; -F key=value sends a form, and -F [email protected] a file in it.

Shell
azrouter api POST /v1/embeddings -d '{"model": "openai/text-embedding-3-large", "input": "hello"}'

An audio, image or video answer is saved to a file when it would go to a terminal; -o names the file. A failed call prints what to do and exits 1.

models

Shell
azrouter models --type image

Lists the models on sale by ID, with their prices in US dollars: per million input and output tokens, or per image, second, million characters or request.

--type keeps one kind: text, image, video, audio or embedding. --cheap lists the lowest price first. --json also gives what each model takes as input.

Some models' price covers some requests only, such as one image a request. The OTHER column then says which requests, and the price of the rest. A model billed per video token shows its price per million video tokens at each resolution, and what a 5-second 720p video at 16:9 costs.

The models page shows the same prices, each next to its market price.

balance

Shell
azrouter balance

Prints your balance, rounded down to the cent. Add credits in Dashboard → Credits.

usage

Shell
azrouter usage --days 30

Shows what your account spent per day (UTC) and model, with the total, for every key and the playground: the numbers in Dashboard → Activity. It covers the last 7 days by default, and up to 90. -m keeps one model.

keys

Shell
azrouter keys

Says which key azrouter uses: AZROUTER_API_KEY, or the one azrouter login saved.

You make, limit and revoke keys in Dashboard → API keys. An API key can't make or revoke keys, so a leaked key can never make more.

skills

Shell
azrouter skills install

Installs the azrouter skill for the coding agents on your computer, so they can chat with other models, make images, videos and speech, and check prices through azrouter. Start a new session of the agent to pick it up.

--agent picks the agents: claude, codex, cursor, gemini, opencode, several separated by commas, or all. Each agent's skill goes where it reads skills:

AgentFolder
Claude Code~/.claude/skills/azrouter
Codex~/.agents/skills/azrouter
Cursor~/.cursor/skills/azrouter
Gemini CLI~/.gemini/skills/azrouter
OpenCode~/.config/opencode/skills/azrouter

Cursor and OpenCode also read the Claude Code and Codex folders, and Gemini CLI reads the Codex one, so --agent all writes those two folders only. --dir picks another folder. A folder that holds another skill is never overwritten.

To install the skill by hand, download SKILL.md and its troubleshooting reference into the agent's folder:

Shell
mkdir -p ~/.claude/skills/azrouter/references
curl -fsSL https://azrouter.dev/cli/SKILL.md -o ~/.claude/skills/azrouter/SKILL.md
curl -fsSL https://azrouter.dev/cli/references/troubleshooting.md -o ~/.claude/skills/azrouter/references/troubleshooting.md

update

Shell
azrouter update --check

Once a day, after a command, azrouter checks for a new release in the background. It installs a newer signed release by itself and tells you the next time you run a command: azrouter: updated 1.0.1 -> 1.1.0.

azrouter update --check only reports. azrouter update installs the latest release now.

Set AZROUTER_NO_UPDATE=1 to turn the daily check off.

logout

Shell
azrouter logout

Forgets the saved key.

AZROUTER_API_KEY uses a key for one command without saving it:

Shell
AZROUTER_API_KEY="sk-..." azrouter balance

version and help

Shell
azrouter version
azrouter --help
azrouter video --help

version prints the version and platform, such as azrouter 1.1.0 (darwin/arm64). --help lists the commands, or a command's flags.

Troubleshooting

Errors start with azrouter: and say what to do. When one ends with (request …), quote that ID if you contact support. Exit code 1 means the command failed, and 2 that its flags or arguments were wrong.

MessageWhat to do
not logged in: run 'azrouter login' (or set AZROUTER_API_KEY)Run azrouter login with a key from Dashboard → API keys.
your API key was not accepted: …The key was deleted or mistyped. Create a new one and run azrouter login again.
not enough balance: top up at https://azrouter.dev/dashboard/creditsAdd credits in Dashboard → Credits, then run the command again.
that model is not available: 'azrouter models' lists the ones on saleThe model ID isn't on sale, or is misspelled. Pick one from azrouter models.
this model takes text only …That model takes text only. Drop -f and --tools, or pick a model that takes them.
this image model accepts one image as b64_json …Check the model page. Nano Banana 2 accepts up to 10 reference images, Grok Imagine Image 2.0 one 1:1 reference image, and GPT Image 2 accepts size and quality. Remove unsupported options or shorten the prompt.
this model takes a prompt with --seconds (4 to 15), --resolution …A Seedance video got a field it doesn't take: use only --seconds, --resolution, --ratio, --image and --no-audio.
--video needs -m … / --video takes the https:// URL of an MP4 fileName a model that takes an input video and give the URL of its file.
The input image … / The input video … / This model takes …The API's own words for an input it can't use (CLI 1.1.14); nothing is billed. Change the input as it says.
no answer: the model used the whole token limit …Raise --max-tokens: reasoning models spend part of it thinking.
the answer was cut before the image arrived …The connection broke. azrouter usage shows whether it was billed; try again once.
… is billed and still kept for a dayThe video is billed and kept for a day: the azrouter video --resume line it prints saves it.
no key to read: …Run azrouter login at a terminal, or pipe the key in: printf '%s\n' "$KEY" | azrouter login.
too many requests: try again in 30 sWait the seconds it names. See Rate limits.
command not found, from your shell~/.local/bin isn't on your PATH: add the line the install script printed, then open a new terminal.
azrouter is not recognized, on WindowsOpen a new terminal: the installer added its folder to your PATH for new ones.