vek1-api — atividade recente
Atividade recente
Sprint 2026-05-20 → 2026-05-21 — Billing completo + endpoint público
Billing module (Fase 1 do pricing)
PR #24
7bf82e2Stripe billing module + quota enforcement + webhookservices/stripe_client.py(singleton wrapper, lazy init)services/billing_service.py—check_quota_or_blockstate machine 3-day grace, FIFO topup consume, bônus 50% primeira recarga,try_charge_overageautomático Day 3,report_usage_to_stripe(worker)routers/billing.py(10 endpoints/internal/billing/*)routers/stripe_webhook.py(signature HMAC validation, 6 events: customer.subscription.{created,updated,deleted}, invoice.paid, invoice.payment_failed, payment_intent.succeeded)requirements-docker.txt: stripe>=11.0,<19- 25 service tests + 18 endpoint tests + 7 webhook tests + 4 E2E reais Stripe test mode
PR #25
660b739/chatquota enforcement + apscheduler + emails graceservices/chat_billing.py— helpers extraídos (resolve_company_id, quota_block_response, record_token_usage)services/rag_service.py— inject quota check noprocess_query_with_functions; acumula tokens cross-iteration; BLOCK retorna mensagem genérica- apscheduler in-process cron 5min reportando usage_record pro Stripe Meter
services/billing_emails.py(Resend) — cota_warning_80, grace_started, grace_expired, charge_succeeded/failed- 223 tests passing + 4 E2E
Endpoint público billing
- PR #26
b277363/billing/plans-public(sub-router sem auth)- Usado pela landing /pricing pra consumir via HTTPS em vez de TCP direto Postgres (firewall corporativo às vezes bloqueia 5434, mas HTTPS 443 sempre passa)
- Retorna só campos não-sensíveis: id, slug, name, monthly_cents, included_tokens, max_*, overage_per_million_cents. Sem stripe_*_id, sem timestamps.
Hot fixes pós-cutover anterior (2026-05-20)
e34d014— no-op rate limit decorator (slowapi opcional)974fafc— auth cache: comparaexpires_atcomo naive UTC (fix timezone TypeError)
Sprint 2026-05-17 → 2026-05-20 — Domain endpoints + Better Auth backing store
Email + auth final
- PR #23
94e80b1— password hash emfindAccountsByUser - PR #22
d3e663d—GET /verifications/by-{value,identifier} - PR #21
5262e8a— Resend transactional +/send-reset-password(X-Webhook-Token)
Domínio completo
- PR #20 token-usage insert/list/summary
- PR #19 product-file by id + PATCH + upsert-by-product
- PR #18 product_files CRUD
- PR #17 include
company_idem evolution-instance lookup - PR #16 agents+leads extras pra cutover
- PR #15
POST /webhook/abacate-pay - PR #14 checkout-state + abacate webhook helpers
- PR #13 dashboard + messages + audit
- PR #12 stores + company
- PR #11 products + documents
- PR #10 agents domain
- PR #9 leads domain
- PR #8 orders domain
- PR #7
0b5ec7fBetter Auth backing store (auth router + adapter purpose-built)
Stock sync
- PR #6 stock-sync coverage hardening
- PR #5 stock sync service + endpoints bidirectional
Function calling
- PR #4 drop invalid product_id (LLM hallucinated slugs causando FK 23503)
e09ec60integration suite DeepSeek realb04300dsales_assistant prompt anti-skipdd2ac9fskip backend persistence quandolead_idpresent- PR #3
create_ordertool + prompt fechamento
Início
- PR #2
/extract-lead+ memory-aware/chat+ order intake prompt - PR #1 align repo com stack deployada + remove leaked secrets
- 2025-10-14
bf11231— vazamento histórico (Opik keys no.env.docker) ainda não rotacionado ffe8adcMigrate Railway → VPS Hermes (Postgres+pgvector + DeepSeek + Ollama)
Estado do remote (snapshot 2026-05-21)
- HEAD pós PR #26 —
/billing/plans-public - Branch:
master - Container
vek1-apirodando com Stripe + apscheduler + Resend ativos - Health:
/health→ llm + postgres + ollama: connected - Webhook Stripe configurado em
https://vek1-api.kodama.solutions/webhooks/stripe
Arquitetura
vek1-api é single source of truth pra TODAS as mutations + integrações externas isoladas. Frontend vek1 fala via HTTP com 3 escopos de token.
Trajetória dos PRs:
- #1-#2 stack alignment + memória + extração lead → agente consultivo
- #3-#4 function calling com
create_order→ agente que fecha pedido - #5-#6 stock sync bidirectional ERP
- #7 Better Auth backing store
- #8-#13 domain endpoints completos
- #14-#15 AbacatePay webhook → PIX completo
- #16-#19 extras cutover
- #20-#23 token usage + Resend + verification
- #24-#25 Billing module completo — Stripe subscription + metered + grace 3-day + emails
- #26
/billing/plans-public(landing acesso via HTTPS)
Próximo (planejado, não iniciado)
- Anual com desconto (annual subscription)
- Coupon codes
- Multi-user / team seats por company
- NFSe quando volume justificar
- Live mode Stripe (atualmente test mode)
- Rotacionar Opik keys vazadas no histórico (commit
bf11231)