Referência
CLI
O comando qi conversa com a mesma API do painel. Serve para uma pessoa, uma tarefa cron ou um pipeline de CI.
Instalação
O pacote @sumeria.ai/qi instala os comandos qi e qi-mcp. Requer Node 20 ou superior.
npm install -g @sumeria.ai/qi # the qi and qi-mcp commands, Node 20+
qi --helpCredenciais
qi auth login pergunta primeiro onde você trabalha — sua organização, encontrá-la pelo seu e-mail ou uma conta pessoal (Free ou Pro) — e depois abre o navegador para você aprovar este computador: a chave é criada e salva na sua pasta de usuário, legível só por você. Para usar uma chave de API Keys, execute qi auth login --key; ela não é exibida ao digitar. As chaves têm o formato sk_live_tenant.… e trazem o seu tenant: não há tenant nem URL para digitar.
qi auth login
# Where do you work? your organization / find it by email / personal account (Free, Pro)
# The browser opens: approve this computer and the key is created and saved for you
qi auth status # account, branch and key in use (the key is masked)
qi auth login --tenant acme # skip the question: your organization's name
qi auth login --key # paste a key from API Keys instead (not echoed)
qi auth switch # sign in to another account; keeps the current one if it fails
qi auth switch --branch # another branch of your organization
qi auth logout # forget the key on this machineNo CI, o ambiente prevalece sobre o arquivo: nada é gravado em disco.
# CI: the key comes from the pipeline's secrets, never from a file or a flag.
# GitHub Actions, for example:
env:
QI_API_KEY: ${{ secrets.QI_API_KEY }}
# QI_TENANT only for older keys (sk_live_<hex>) that do not carry their tenant
# QI_BASE_URL advanced: point at another environmentNão há flag para a API key, de propósito: um argumento vai parar no histórico do seu shell e, enquanto o processo roda, na lista de processos que qualquer usuário da máquina pode ler.
Variáveis de ambiente
| Variável | Para que serve |
|---|---|
QI_API_KEY | A chave secreta. |
QI_TENANT | Somente para chaves antigas (sk_live_ seguido de hexadecimal), que não trazem o tenant. |
QI_BASE_URL | Avançado: aponta para outro ambiente. Normalmente não é necessário. |
QI_CONFIG_PATH | Opcional: muda o arquivo de configuração (e o state.json ao lado dele). |
QI_STATE_PATH | Opcional: muda o arquivo de estado do qi watch. |
QI_LANG | Opcional: idioma da CLI (en, es, …). |
Comandos
qi auth login # sign in from the browser and save the key
qi auth status # which account and key are in use (masked)
qi auth switch [--branch] # another account, or another branch
qi auth logout # forget the key on this machine
qi doctor # config, API, plan, modules, name rules, ffmpeg
qi usage # plan, QI tokens used, period end
qi lang [code] # CLI language: en es zh pt fr de ja
qi upload audio <file|folder...> # recordings (Speech Analytics)
qi upload text <file|folder...> # conversations (Text Analytics)
qi upload bot <file|folder...> --bot <p> # bot conversations (Bot Analytics)
qi validate <file|folder...> # check names against the tenant's rules
qi rename <file|folder...> [--apply] # rename local files with --prefix/--suffix/--key
qi convert <file|folder...> --to <fmt> # convert audio with the system's ffmpeg
qi forms list [--type audio|text|bot] # forms and the key uploads use
qi bots list # bot profiles (plans with Bot Analytics)
qi interactions list [--all] # analysed conversations
qi interactions get <id> # status, dialogue, answers
qi interactions wait <id> # until processing finishes
qi interactions export --format csv|json # [--with-answers]
qi watch <folder...> # upload new files as they appear
qi schedule print --every <cron> -- ... # print a cron line or a schtasks commandListas longas de arquivos são divididas por conta própria em lotes de 10, e um arquivo rejeitado não derruba os demais: ele é separado e o lote é reenviado.
Um envio bem-sucedido significa que os arquivos foram aceitos e enfileirados. A transcrição e a análise levam minutos: qi interactions wait bloqueia até que todas as etapas se estabilizem.
Opções
Listagem e exportação
| Opção | Para que serve |
|---|---|
--limit <n> --page <n> | Tamanho da página (no máximo 200) e página, a partir de 0. |
--from <date> --to <date> | Datas ISO, sempre juntas. |
--type <audio|text> | audio ou text. Padrão: audio. |
--agent-type <human|bot> | human ou bot: quem atendeu. |
--form <id> | Somente interações avaliadas com esse formulário (id). |
--all | Todas as páginas, não apenas uma. |
--format <csv|json> --out <file> | Exportação: csv ou json, para um arquivo ou para a saída padrão. |
--with-answers | Exportação: adiciona as respostas de cada interação. |
--timeout <s> --interval <s> | Tempos de wait e watch, em segundos. |
--json | Saída em JSON, para scripts. |
Arquivos e nomes
| Opção | Para que serve |
|---|---|
-r, --recursive | Desce para as subpastas. |
--include <glob> --exclude <glob> | Repetível, comparado com o nome do arquivo. |
--prefix <p> --suffix <s> | Envia (ou renomeia) com outro nome; o arquivo em disco não é tocado. |
--key <KEY> --key-from-folder | Chave do formulário acrescentada como _KEY (tenant compartilhado), ou o nome da pasta. |
--company <c> | Tenant próprio: confere também o segmento da empresa. |
Envio
| Opção | Para que serve |
|---|---|
--form <key|id> | Formulário por chave ou id. |
--analysis <full|transcript> | Tenant compartilhado: full ou transcript. |
--bot <bot_id|name> | Perfil de bot por bot_id ou nome (upload bot). |
--concurrency <n> | Requisições de 10 arquivos em andamento. Padrão: 2. |
--retries <n> | Novas tentativas em 429 e 5xx, com backoff exponencial. Padrão: 3. |
--dry-run | Mostra os nomes finais e o que seria rejeitado; não envia nada. |
--convert <mp3|wav|…> | Converte com ffmpeg antes de enviar. |
-i, --interactive | Escolha formulário, bot e análise em um menu. |
Conversão
| Opção | Para que serve |
|---|---|
--to <mp3|wav|flac|ogg|m4a> | Formato de saída: mp3, wav, flac, ogg ou m4a. |
--bitrate <64k> --mono --sample-rate <hz> --trim-silence --normalize | Ajustes do áudio convertido. |
--out-dir <dir> | Pasta de saída. |
-y, --yes | Instala o ffmpeg sem perguntar. Sem terminal, a CLI apenas mostra o comando: nunca instala em silêncio. |
Monitoramento e agendamento
| Opção | Para que serve |
|---|---|
--type <audio|text|bot> | Canal do watch: audio, text ou bot. |
--interval <s> | Com que frequência a pasta é verificada, em segundos. Padrão: 60. |
--settle <s> | Segundos em que o tamanho de um arquivo deve ficar estável antes de ele ser pego. Padrão: 2. |
--done-dir <dir> | Move para lá o que foi enviado. |
--once | Apenas uma rodada, para um agendador. |
--every "<cron>" | Expressão cron para schedule print. |
--platform <linux|darwin|win32> | Para qual sistema mostrar o comando. |
--name <task> | Nome da tarefa agendada. |
Receitas
Enviar uma pasta
Percorre subpastas, filtra por padrão e escolhe o formulário para o lote inteiro.
# A folder, recursively, only .mp3, evaluated against the form VENTAS
qi upload audio ./grabaciones -r --include "*.mp3" --form VENTAS
# Shared tenants: transcript only, no evaluation
qi upload audio ./grabaciones --analysis transcript
# Choose form, bot and analysis from a menu
qi upload audio ./grabaciones -iPrefixo, sufixo e chave
Eles mudam o nome com que cada arquivo é enviado, não o arquivo. Experimente --dry-run primeiro; qi rename --apply é o único que renomeia em disco.
# Preview the names files would be sent under; nothing is uploaded
qi upload audio ./grabaciones --prefix dev_ --suffix _lote2 --key VENTAS --dry-run
# Every reason a name is refused, per file (exit 1 if any is bad)
qi validate ./grabaciones
# Rename on disk: preview first, then --apply
qi rename ./grabaciones --prefix acme_
qi rename ./grabaciones --prefix acme_ --applyConverter antes de enviar
Usa o ffmpeg já instalado. Se não houver, em um terminal ele pergunta antes de instalá-lo (winget, brew, apt ou dnf, conforme o sistema).
# Convert, then upload the result (system ffmpeg, into a temporary folder)
qi upload audio ./wav --convert mp3
# Only convert
qi convert ./wav --to mp3 --bitrate 64k --mono --sample-rate 16000 --trim-silence --normalize
qi convert ./wav --to mp3 --out-dir ./mp3Monitorar uma pasta
Ele lembra o que enviou em ~/.qi/state.json (caminho, tamanho e data de modificação): um arquivo é enviado uma vez e de novo apenas se mudar. Um que falhou é tentado de novo na próxima rodada.
# Upload what lands in ./inbox, every 60 s, and move it to ./sent
qi watch ./inbox --interval 60 --done-dir ./sent --form VENTAS
# One round only, for a scheduler
qi watch ./inbox --onceAgendar com cron ou Agendador de Tarefas
qi schedule print mostra a linha do crontab ou o comando schtasks /Create, com caminhos absolutos para o node e a CLI. Não instala nada: você mesmo adiciona a linha.
# Linux / macOS: prints the crontab line
qi schedule print --every "0 2 * * *" -- upload audio /var/recordings --form VENTAS
# Windows: prints the schtasks /Create command (daily, weekly, hourly or every N minutes)
qi schedule print --every "0 2 * * *" --platform win32 --name qi-nightly -- upload audio D:\grabacionesLer e exportar resultados
O CSV segue a RFC 4180, e o texto que começa com =, +, - ou @ recebe um apóstrofo na frente para que uma planilha o mostre em vez de executá-lo.
qi interactions list --limit 25 --from 2026-09-01 --to 2026-09-08
qi interactions list --all --agent-type bot --json
qi interactions export --format csv --out week.csv --from 2026-09-01 --to 2026-09-08 --with-answers
qi interactions export --format json --with-answers > all.jsonCódigos de saída
| Código | Significado |
|---|---|
0 | Tudo certo. |
1 | A requisição falhou: o motivo está no stderr. |
2 | O comando estava errado. |
Feito para cron e CI. Um envio parcial sai com 1 e explica o motivo por arquivo:
FAILED 1 accepted · 1 rejected · 0 failed
├─ SUCCEEDED call-001.mp3
└─ REJECTED notas.mp3 missingFields: 1 fields, 7 required: tenant_company_YYYYMMDD_HHMMSS_callId_clientId_agentId# Nightly upload, alerting only when it actually breaks
qi upload audio /var/recordings/$(date +%F) || notify-team "QI upload failed"Prompt para agentes
Cole isto em um agente de programação (Claude Code, Cursor, …) para que ele integre a CLI ao seu projeto.
You are integrating the Sumeria Quality Intelligence CLI (@sumeria.ai/qi) into this project.
1. Install: npm install -g @sumeria.ai/qi (or add it as a dev dependency for CI). Node 20+.
2. Authenticate once with "qi auth login": it asks where the user works and approves the
computer in the browser; the key is stored outside the repo. In CI, provide QI_API_KEY
from the pipeline's secrets instead — never as a command-line flag or in a file that
could get committed. QI_TENANT is only needed for older keys (sk_live_<hex>).
3. Use "qi upload audio <path>" and "qi upload text <path>" to send files or folders; they
go in requests of 10 and are retried on 429/5xx.
4. A successful upload only means the files were accepted and queued — use
"qi interactions wait <id>" or poll "qi interactions list" to see when they were analysed.
5. Exit codes: 0 fine, 1 the request failed (reason on stderr), 2 the command was wrong.
6. Wire this into our build/release process: <tell the agent where the files to upload
live in this repo, and when the command should run>.
Ask before writing any credential to a file that could be committed.