Skip to content

feat(providers): oferecer modelo Verboo quando o limite da conta do usuário acaba - #80

Open
savass33 wants to merge 8 commits into
feat/provider-accounts-byokfrom
feat/limit-switch-to-verboo
Open

savass33 wants to merge 8 commits into
feat/provider-accounts-byokfrom
feat/limit-switch-to-verboo

Conversation

@savass33

@savass33 savass33 commented Nov 3, 2026

Copy link
Copy Markdown

Resumo

Quando um modelo usado com a conta do próprio usuário para porque o plano ou o saldo acabou, a CLI agora:

  1. Mostra uma mensagem clara, com o horário de renovação quando o provedor informa. Exemplo: "o limite do seu plano ChatGPT acabou (renova 14:30)".
  2. Abre na hora um diálogo para trocar para um modelo Verboo, começando pelo último usado, sem precisar digitar /model.
  3. Se o usuário escolher um modelo: troca o modelo da sessão e reenvia a última mensagem. "Manter o modelo atual" não muda nada.

Erros reconhecidos:

Provedor Erro
Plano ChatGPT (Codex) usage_limit_reached (429), com resets_at / resets_in_seconds
Chave OpenAI insufficient_quota / "exceeded your current quota"
Chave Anthropic "credit balance is too low"
  • Rate limit temporário continua com a nova tentativa normal.
  • O limite do plano ChatGPT deixa de ser retentado, porque só renova depois.
  • Modelos Verboo seguem com as mensagens de plano do roteador.
  • Erros que já estavam na conversa ao abrir a sessão (por exemplo, ao retomar) não abrem o diálogo.

Base

Empilhado sobre o #75, porque depende dos provedores de chave de API. Depois do merge do #75, a base deste PR vira main.

Testes

  • providerLimitErrors.test.ts: classificação por provedor, rate limit temporário ignorado, mensagem com prefixo, e a ligação com errors, withRetry e REPL.
  • limit-switch.test.ts: opções (último modelo Verboo primeiro, máximo de 5, opção de manter) e a última mensagem digitada (pula meta e tool_result).
  • Local, com Bun 1.3.13: check-cli-quality --suite 367/367 e --terminal 36/36.

🤖 Generated with Claude Code

savass33 and others added 8 commits November 3, 2026 19:44
…s out

When a model reached with the user's own account stops because the plan
or balance ran out (ChatGPT plan via Codex "usage_limit_reached", OpenAI
"insufficient_quota", Anthropic "credit balance is too low"), the error
message says so — with the renewal time when the provider gives it — and
the REPL opens a dialog right away offering a Verboo model, last used
first. Choosing one switches the session model and resends the last
prompt; "keep" leaves everything as it was. Temporary rate limits keep
their normal retry, and the ChatGPT usage limit is no longer retried.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fects

Merges the own-key fixes from #75. Found by end-to-end validation:

- withRetry replaced the ChatGPT and OpenAI limit errors with a generic
  one, so the dialog only ever opened for Anthropic.
- /compact on an exhausted account kept the limit message as the summary
  and destroyed the conversation context.
- A limit hit after tools ran sent the prompt again, repeating their side
  effects. Now nothing is resent and the dialog says so. When nothing ran,
  the failed attempt leaves history so the model gets the request once.
- The compaction summary, images and task notifications are no longer
  taken for what the user typed, nor replaced by an older prompt.
- The dialog was opened as a hidden slash command, which wiped the prompt
  draft, polluted history and the transcript, could be shadowed by a skill
  and broke with --disable-slash-commands. The REPL now renders it directly.
- /resume no longer reopens the dialog for an old error.
- "Last Verboo model first" tracks a real router model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The resend ran in the same tick as the switch, so onSubmit still had the old
model: the prompt went back to the exhausted account and the dialog reopened.
The confirmation messages used the 'info' level, which only shows in verbose
mode, so nobody saw "Modelo alterado" or "Modelo mantido".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion

A message typed while the limit answer was on its way went straight to the
exhausted account. With more than four Verboo models, "Manter o modelo atual"
fell below the visible part of the list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant