npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@protoethik-ai/ode-code

v1.1.0

Published

TyloAI terminal-based coding assistant with direct workspace editing

Readme

Ode Code 中文快速指南(Key、计费、数据库)

本文说明新版 Ode Code 的工作流、计费规则,以及需要在 现有 Supabase 实例https://oozxrnrxrapiylcsobgi.supabase.co)创建的表结构。最新链路(无登录流程)如下:

  1. 在浏览器打开 platform.tyloai.com(即仓库根目录 index.html),点击 “Generate new key” 生成 ode-code 专用 API Key(记录写入 Supabase)。
  2. 复制生成的 sk- Key,粘贴到终端运行的 ode code / tyloai
  3. CLI 每次请求前自动校验 Supabase 配额,展示 “Working” 进展、计时器、剩余额度。
  4. 免费额度用完后,如在仪表盘勾选 “Use balance after 50 free calls”,则按 $0.10/次从余额扣费,否则直接报错停止。

计费逻辑(与 CLI/前端同步)

  • 每日免费 50 次:字段 free_quota=50free_used_today 记录当日使用量,跨天自动归零
  • 付费开关bill_after_free=truebalance_cents>=10 时,超出免费额度的调用按 call_cost_cents=10($0.10)扣减,并累计到 paid_used_today / paid_spend_cents
  • 实时展示index.html 的「ode-code Usage」卡片和 CLI :status 都读取上述字段,展示免费剩余、今日总调用、已扣费用、余额
  • 上游调用:若 ode_api_keys 中不存在映射,CLI 会直接使用终端 api_key 调 Tylo 接口(默认基址 https://api-for-tyloai.tyloai.com/v1

Supabase 表(必需)

create table if not exists public.ode_terminal_keys (
  id uuid primary key default gen_random_uuid(),
  user_id uuid not null,
  email text not null,
  display_name text,
  api_key text not null,
  free_quota integer not null default 50,
  free_used_today integer not null default 0,
  paid_used_today integer not null default 0,
  paid_spend_cents integer not null default 0,
  balance_cents integer not null default 0,
  bill_after_free boolean not null default false,
  usage_date date,
  call_cost_cents integer not null default 10,
  session_code text,
  status text not null default 'active',
  inserted_at timestamptz not null default now(),
  updated_at timestamptz not null default now()
);

create unique index if not exists ode_terminal_keys_api_key_idx on public.ode_terminal_keys(api_key);
create unique index if not exists ode_terminal_keys_user_idx on public.ode_terminal_keys(user_id);

若需要自动更新时间戳,可复用:

create or replace function public.touch_updated_at()
returns trigger as $$
begin new.updated_at = now(); return new; end; $$ language plpgsql;
drop trigger if exists set_updated_at on public.ode_terminal_keys;
create trigger set_updated_at before update on public.ode_terminal_keys
for each row execute function public.touch_updated_at();

可选:上游密钥映射

如需将终端 key 映射到另一组 TyloAI Provider Key,可建表:

create table if not exists public.ode_api_keys (
  id uuid primary key default gen_random_uuid(),
  terminal_api_key text not null unique,
  provider_api_key text not null,
  status text not null default 'active',
  rotated_at timestamptz,
  expires_at timestamptz,
  inserted_at timestamptz not null default now(),
  updated_at timestamptz not null default now()
);
create unique index if not exists ode_api_keys_terminal_idx on public.ode_api_keys(terminal_api_key);

CLI 查询顺序:若找不到 provider_api_key,直接用终端 api_key 调用。

RLS 建议(匿名即可)

alter table public.ode_terminal_keys enable row level security;
create policy "ode-terminal-upsert" on public.ode_terminal_keys for insert to anon with check (true);
create policy "ode-terminal-update" on public.ode_terminal_keys for update to anon using (true) with check (true);

alter table public.ode_api_keys enable row level security;
create policy "ode-api-read" on public.ode_api_keys for select to anon using (status = 'active');

前端与 CLI 均会带上 api_key=eq.<key> 过滤条件,仅读写当前登录行。

前端/CLI 对应关系

  • index.html(根目录、platform.tyloai.com):唯一入口,直接生成/加载 ode-code Key,写 Supabase ode_terminal_keys,可开关付费续用。
  • CLI(lib/cli.js):用户直接粘贴 sk- Key;每次请求前通过 Supabase 校验额度,“Working” 行内置转圈 + 跑马灯 + 计时器,错误时红色提示。

环境变量(如需自定义)

export ODE_SUPABASE_URL="https://oozxrnrxrapiylcsobgi.supabase.co"
export ODE_SUPABASE_ANON_KEY="<your-anon-key>"
export ODE_SUPABASE_TABLE="ode_terminal_keys"
export ODE_SUPABASE_API_TABLE="ode_api_keys"
export TYLOAI_API_BASE_URL="https://api-for-tyloai.tyloai.com/v1"

完成以上配置后即可在 Supabase 中看到调用计数、扣费和余额,前端与 CLI 会实时读取并提示用量。