@flovialabs/sdk 0.1.22 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.24
4
+
5
+ - Expect Relay contract `2026-10-07.217`. Tool and model availability depend on the Relay's configuration and the account's access.
6
+ - Saved resets can include the first available choice of each kind. The SDK preserves the optional `resets` field. The CLI shows the choices and their grant IDs. A 5-hour reset clears 5-hour usage. A weekly reset clears weekly and 5-hour usage. Monthly usage stays unchanged.
7
+ - `flovia_usage_today` accepts a date-only `since` at midnight UTC on the updated Relay. The SDK and CLI pass it through. A paged CLI query still needs the exact `--since` from the previous reply with its cursor.
8
+ - `GenerationRequest.model` includes `gpt-6.2-astra` and `gpt-6.2-sol`. Where offered, both default to `low` reasoning effort and refuse `none`. The CLI uses `gpt-6-luna`.
9
+ - CLI and SDK docs describe how the account's spend mode and each key's paid caps affect generation, and the separate CoinGecko daily quota.
10
+
11
+ ## 0.1.23
12
+
13
+ - CLI: `flovia resets` starts the saved-reset and status reads concurrently, with one waiting indicator. Both reads start even if one fails; if both fail, the first rejection determines the error. Successful text and JSON keep the same shape, and no reset is used or request retried automatically.
14
+ - CLI: TTY waiting feedback updates one stderr line instead of adding a line every five seconds, then clears the line and timer on success or failure. Piped stderr and `--json` still have no waiting feedback.
15
+ - Expect the same contract `2026-10-07.208`; public client methods, types and runtime dependencies are unchanged.
16
+
3
17
  ## 0.1.22
4
18
 
5
19
  - Expect contract `2026-10-07.208` and include `team_feature_off` in the typed public refusal codes. This release adds no client methods or runtime dependencies.
package/README.md CHANGED
@@ -10,9 +10,19 @@ TypeScript client and command-line tool for [Flovia](https://api.flovia.dev). It
10
10
  ## Install
11
11
 
12
12
  ```sh
13
- npm install --save-exact @flovialabs/sdk@0.1.22
13
+ npm install --save-exact @flovialabs/sdk@0.1.24
14
14
  ```
15
15
 
16
+ ## 0.1.24 release notes
17
+
18
+ This release expects Relay contract `2026-10-07.217`. `flovia resets` shows the available 5-hour and weekly choices when the Relay includes them. `usageToday({ since })` and `flovia usage --since` accept `YYYY-MM-DD` as midnight UTC with the updated Relay.
19
+
20
+ `client.generate()` accepts the model names `gpt-6.2-astra` and `gpt-6.2-sol` when the Relay offers them. These models reject reasoning effort `none` and default to `low` when it is omitted. The CLI's `generate` command uses `gpt-6-luna`. The CLI spending guidance describes the account's spend mode and per-key caps.
21
+
22
+ ## 0.1.23 release notes
23
+
24
+ `flovia resets` reads saved resets and free-window status concurrently and shows one waiting indicator. Both reads start even if one fails; if both fail, the first rejection determines the error. TTY waiting feedback updates one stderr line and clears it when the request finishes. Successful output and JSON keep their existing shape; piped stderr and `--json` have no waiting feedback. This release expects the same contract `2026-10-07.208` and changes no public client methods, types or runtime dependencies.
25
+
16
26
  ## 0.1.22 release notes
17
27
 
18
28
  This release expects contract `2026-10-07.208` and includes `team_feature_off` in the typed public refusal codes. It adds no client methods or runtime dependencies. Per-Team sandbox opt-in remains deployment-gated. Installing the SDK does not enable that gate or change a Team owner’s setting.
@@ -80,7 +90,7 @@ const usage = await flovia.usageToday(); // today, UTC
80
90
  const tools = await flovia.listTools();
81
91
  const reply = await flovia.call("flovia_status");
82
92
 
83
- // A text generation (uses your free allowance first, then your purchased balance). Save the operation id before sending.
93
+ // A text generation. Save the operation id before sending.
84
94
  const op = newOperationId();
85
95
  const request = { model: "gpt-6-luna" as const, input: "Explain a DEX aggregator in one sentence.", reasoning: { effort: "low" as const } };
86
96
  // Persist { op, request } in your application's private storage before the next line.
@@ -101,11 +111,11 @@ const priceRequest = {
101
111
  request_text: "What is Bitcoin's USD price?", purpose: "check a price with its update time",
102
112
  conversation_id: "sdk-price-example", operation_id: newOperationId(),
103
113
  };
104
- // Save priceRequest before sending; this lookup uses your free allowance or purchased balance.
114
+ // Save priceRequest before sending. New upstream calls through Flovia's CoinGecko pool count toward its separate daily limit.
105
115
  const price = await flovia.call("flovia_coingecko", priceRequest);
106
116
  ```
107
117
 
108
- If either call asks for a notice or consent, stop and follow the human-answer flow below. Read the returned source time, coverage and missing-value notes; a successful lookup is not a guarantee that it answers your question. Flovia exposes selected read-only paths, methods and public HTML hosts, not every feature of the upstream plans. Use the live catalog for the supported subset. OpenAI supports text generation with `gpt-6-luna`; it does not fetch other providers or offer image/audio generation.
118
+ CoinGecko’s daily quota is separate from Flovia’s metered allowance, purchased balance and plan credit. If either call asks for a notice or consent, stop and follow the human-answer flow below. Read the returned source time, coverage and missing-value notes; a successful lookup is not a guarantee that it answers your question. Flovia exposes selected read-only paths, methods and public HTML hosts, not every feature of the upstream plans. Use the live catalog for the supported subset. OpenAI supports text generation with `gpt-6-luna`; it does not fetch other providers or offer image/audio generation.
109
119
 
110
120
  ### Runway images and videos
111
121
 
@@ -211,7 +221,7 @@ try {
211
221
  After installing this SDK and setting `FLOVIA_KEY` privately, run:
212
222
 
213
223
  ```sh
214
- # One new CoinGecko lookup; uses your free allowance or purchased balance.
224
+ # One new CoinGecko lookup. New upstream calls through Flovia's pool count toward CoinGecko's separate daily limit.
215
225
  node first-price.mjs --new
216
226
  # Same request and operation id; reopen promptly, while the saved answer is available.
217
227
  node first-price.mjs --replay
@@ -221,7 +231,7 @@ node first-price.mjs --saved
221
231
 
222
232
  The example saves the request and operation id **before** sending, in `.flovia-price/request.json` (0600 inside a 0700 directory), and the returned answer in `answer.json` (0600). Keep this directory private and out of Git. Repeating `--new` refuses to overwrite it. Do not delete it or change the id to recover a lost answer. `--replay` sends the saved arguments unchanged; if the saved text is unavailable or the outcome is pending/unknown, follow the error's `next_step` instead of making a new request. A notice or consent refusal needs the person's answer; this script never supplies one.
223
233
 
224
- The displayed result separates the USD price, CoinGecko's update time, Flovia's original receipt time, lookup id and the server's charge guidance. Unknown values stay `null`; missing cost is not zero. A replay or local saved display is labelled as such and never presented as a live update. For period usage, run `npx flovia usage` separately; it is your private account data, not the cost of this one result. A browser demo may display the public price and attribution from your server, but must not expose the Flovia key, private reply files or account usage, or offer an unauthenticated refresh endpoint that spends your allowance. The example does not auto-refresh. Follow the provider's attribution and redistribution terms.
234
+ The displayed result separates the USD price, CoinGecko's update time, Flovia's original receipt time, lookup id and the server's charge guidance. Unknown values stay `null`; missing cost is not zero. A replay or local saved display is labelled as such and never presented as a live update. For period usage, run `npx flovia usage` separately; it is your private account data, not the cost of this one result. A browser demo may display the public price and attribution from your server, but must not expose the Flovia key, private reply files or account usage, or offer an unauthenticated refresh endpoint that can use up your CoinGecko daily quota. The example does not auto-refresh. Follow the provider's attribution and redistribution terms.
225
235
 
226
236
  ### Code runs and Team tasks
227
237
 
@@ -325,7 +335,7 @@ npx flovia resets use 42 --yes # use saved reset 42 (cannot be undone)
325
335
  npx flovia consent # current notice version, your yes and the notice text (read-only)
326
336
  npx flovia consent accept relay-consent-19 --yes # your own yes to the version just shown (same as Console)
327
337
  npx flovia key-caps # each key's daily and monthly spending cap and use (read-only)
328
- npx flovia key-caps set <key-id> --day 5 --month none # cap one key; a call over it is refused, nothing charged
338
+ npx flovia key-caps set <key-id> --day 5 --month none # set this key's daily paid cap and remove its monthly cap
329
339
  npx flovia spend-mode # free-only or allow-paid (read-only)
330
340
  npx flovia spend-mode free-only # never use the purchased balance or plan credit
331
341
  npx flovia sandbox run python job.py # queue your own code; prints an operation_id first, then the run_id
@@ -338,7 +348,7 @@ npx flovia agents-md # a short note for CLAUDE.md or AGENTS.md
338
348
  npx flovia help
339
349
  npx flovia --version
340
350
  ```
341
- These commands run after installing `@flovialabs/sdk` in the current project. Without a local installation, specify the package: `npx --package=@flovialabs/sdk@0.1.22 flovia --help`. Use a unique operation id for each new request; `sdk-example-0001` is only an example. Save the id, prompt and options before sending, and keep them unchanged for replay.
351
+ These commands run after installing `@flovialabs/sdk` in the current project. Without a local installation, specify the package: `npx --package=@flovialabs/sdk@0.1.24 flovia --help`. Use a unique operation id for each new request; `sdk-example-0001` is only an example. Save the id, prompt and options before sending, and keep them unchanged for replay.
342
352
 
343
353
  Get or manage your key in [Console](https://console.flovia.dev/groupbuy/), save it privately, then run `flovia status --key-file <saved-key-file>`. A connected key can still have sharing declined, withdrawn or stopped; `status` shows those separately from provider availability. It never answers consent for you.
344
354
 
@@ -389,9 +399,10 @@ Keep the same `--key-file` and `--base-url` too. For a prompt starting with a hy
389
399
  `status` shows your purchased balance. `usage` shows lookup counts, free allowance percentages and the purchased-balance totals from the server; its generation subtotal is already included in the period total. Missing amounts show `-`, not zero. It does not add rounded endpoint percentages. To continue a listing, copy the printed command with its exact `--since` and `--cursor`; do not combine `--days` with `--cursor`.
390
400
 
391
401
  - Every command takes `--json` (the raw reply), `--base-url URL`, `--timeout SECONDS` and `--key-file PATH`.
392
- - `generate` uses your free allowance first, then your purchased balance. It needs `--op ID` or `--new-op`, and asks for confirmation on a terminal; add `--yes` in scripts.
402
+ - `generate` needs `--op ID` or `--new-op` and asks for confirmation on a terminal. Add `--yes` in scripts. In `allow-paid` mode with an active plan, eligible plan credit takes priority, with purchased balance as a fallback. Without a plan, an eligible purchased balance takes priority over the free allowance. The selected source must cover the whole request.
403
+ - `spend-mode free-only` prevents metered calls from using purchased balance or plan credit account-wide. A metered call needs enough free allowance to run in this mode. An active plan makes that allowance unavailable, so metered calls are refused in free-only mode. `key-caps` limits each key’s paid use from purchased balance and plan credit per UTC day and month. Eligible calls can still use the free allowance. See [Free and paid use](https://docs.flovia.dev/usage/) for current limits.
393
404
  - `generate` prints the response status and incomplete reason. `incomplete` / `max_output_tokens` means the delivered text stopped at the output limit, not that a continuation ran. Exit 0 means the response was delivered, not that the text is complete or correct. `--json` retains the full public response.
394
- - `resets` only reads: the number of saved resets, the next to expire, and the 5-hour and weekly windows. `resets use <id> --yes` uses one; both free windows (5-hour and week) start again from 0%. Without `--yes` nothing is sent, even on a terminal. It is never resent automatically: after a lost reply, run `flovia resets` before trying again. `Not used; nothing changed.` exits 1. In code: `client.bankedResets()` and `client.useBankedReset(id)`.
405
+ - `resets` reads the number of saved resets, the next to expire, and the 5-hour and weekly windows. It shows the first reset to expire of each kind when the Relay provides those details. `resets use <id> --yes` uses the saved reset with that ID when it can be applied. A 5-hour reset clears only 5-hour usage. A weekly reset clears weekly and 5-hour usage. Monthly usage stays unchanged. Without `--yes` nothing is sent, even on a terminal. It is never resent automatically: after a lost reply, run `flovia resets` before trying again. `Not used; nothing changed.` exits 1. In code: `client.bankedResets()` and `client.useBankedReset(id)`.
395
406
  - `consent` only reads: the current notice version, the version you last said yes to, whether that yes is to an earlier version (it keeps working; continued use accepts the current one), and the full notice. `consent accept <version> --yes` records your own yes to exactly that version, the same as answering in Console; an older version is refused and nothing is recorded, and a repeat changes nothing. Without `--yes` it shows the text and sends nothing (exit 2). Only the account owner should run it, never an agent on their behalf. In code: `client.consent()` and `client.acceptConsent(version)`.
396
407
  - Exit codes: 0 ok, 1 an error from Flovia, 2 a usage error.
397
408
 
package/dist/cli.js CHANGED
@@ -33,8 +33,8 @@ const COMMANDS = {
33
33
  tools: { usage: "tools [tool]", about: "list offered tools, or inspect one tool's description and arguments", flags: {} },
34
34
  call: { usage: "call <tool> ['<json args>' | -]", about: "call a tool; - reads a JSON object from stdin", flags: {} },
35
35
  "runway-output": { usage: "runway-output <generation_id> --out PATH", about: "download an existing private output; never regenerates or overwrites", flags: { "--out": true } },
36
- generate: { usage: "generate (--op ID | --new-op) [--max-output N]\n [--reasoning-effort LEVEL] [--yes] <prompt | ->", about: "a text generation (uses your free allowance, then your purchased balance)", flags: { "--op": true, "--new-op": false, "--max-output": true, "--reasoning-effort": true, "--yes": false } },
37
- resets: { usage: "resets [use <id> --yes]", about: "check saved resets (read-only), or use one to restart both free windows", flags: { "--yes": false } },
36
+ generate: { usage: "generate (--op ID | --new-op) [--max-output N]\n [--reasoning-effort LEVEL] [--yes] <prompt | ->", about: "request an OpenAI text generation", flags: { "--op": true, "--new-op": false, "--max-output": true, "--reasoning-effort": true, "--yes": false } },
37
+ resets: { usage: "resets [use <id> --yes]", about: "check saved resets, or use one to restore free allowance", flags: { "--yes": false } },
38
38
  consent: { usage: "consent [accept <version> --yes]", about: "read Flovia's current notice and your answer, or record your own yes to it", flags: { "--yes": false } },
39
39
  "key-caps": { usage: "key-caps [set <key-id> --day <usd|none> --month <usd|none>]", about: "read or set each API key's own daily and monthly spending cap", flags: { "--day": true, "--month": true } },
40
40
  "spend-mode": { usage: "spend-mode [free-only | allow-paid]", about: "read or set whether calls may spend purchased or plan credit", flags: {} },
@@ -116,11 +116,11 @@ export function help(command) {
116
116
  ...Object.values(COMMANDS).flatMap((x) => [` ${x.usage}`, ` ${x.about}`])] : [`Usage: flovia ${c.usage}`, ` ${c.about}`];
117
117
  lines.push("", "Options: " + GLOBAL, "", `Get or manage your key: ${CONSOLE}`, "Save the key privately, then: flovia status --key-file <saved-key-file>", "Or set FLOVIA_KEY, or save it to ~/.config/flovia/key.", "Never paste the key into a command argument.");
118
118
  if (command === "generate")
119
- lines.push("", "Default output limit: 1000 tokens; maximum: 4000.", "--reasoning-effort: none (default), low, medium, high, xhigh, max.", "Reasoning shares the output token limit; higher effort can leave less visible text.", "Long answers can take minutes. Save the id, same input, output limit and effort.", " flovia generate --new-op --reasoning-effort high --yes - < prompt.txt", "Replay only: replace --new-op with --op <saved-id>; keep everything else.", "Use -- before a prompt that starts with a hyphen.");
119
+ lines.push("", "Default output limit: 1000 tokens; maximum: 4000.", "--reasoning-effort: none (default), low, medium, high, xhigh, max.", "Reasoning shares the output token limit; higher effort can leave less visible text.", "Check spending settings with flovia spend-mode and flovia key-caps.", "Long answers can take minutes. Save the id, same input, output limit and effort.", " flovia generate --new-op --reasoning-effort high --yes - < prompt.txt", "Replay only: replace --new-op with --op <saved-id>; keep everything else.", "Use -- before a prompt that starts with a hyphen.");
120
120
  if (command === "tools" || c === undefined)
121
121
  lines.push("", "Inspect one tool: flovia tools <tool> --json", "Inspect all tool arguments: flovia tools --json", "Read-only example: flovia call flovia_status '{}'");
122
122
  if (command === "resets")
123
- lines.push("", "flovia resets only reads; it never uses one.", "Using one starts both free windows (5-hour and week) again; it cannot be undone.", " flovia resets use <id> --yes", "It is never resent automatically; after a lost reply, run flovia resets first.");
123
+ lines.push("", "flovia resets only reads; it never uses one.", "A 5-hour reset clears only 5-hour usage. A weekly reset clears weekly and 5-hour usage. The monthly window is unchanged. Using a reset cannot be undone.", " flovia resets use <id> --yes", "It is never resent automatically; after a lost reply, run flovia resets first.");
124
124
  if (command === "consent")
125
125
  lines.push("", "flovia consent only reads; it never answers.", "Only the account owner may answer, for themselves, after reading the notice:", " flovia consent accept <version> --yes", "Without --yes nothing is sent. The same answer can be given in Console.");
126
126
  if (command === "install")
@@ -325,8 +325,11 @@ export function renderResets(r, s, now = Date.now()) {
325
325
  lines.push(`${label("next to expire")}id ${r.next.id}, expires ${when(r.next.expires_at, now)}`);
326
326
  for (const [name, w] of [["free 5-hour", s.five_hour], ["free week", s.week]])
327
327
  lines.push(`${label(name)}${pct(w?.used_pct)} used${w?.resets_at ? `, resets ${when(w.resets_at, now)}` : ""}`);
328
- if (r.next)
329
- lines.push("Using one starts both free windows (5-hour and week) again from 0%. It cannot be undone.", `To use it: flovia resets use ${r.next.id} --yes`);
328
+ if (r.resets)
329
+ for (const reset of r.resets)
330
+ lines.push(`${reset.kind === "five_hour" ? "5-hour reset" : "Weekly reset (includes 5-hour)"}: id ${reset.id}, expires ${when(reset.expires_at, now)}. Use: flovia resets use ${reset.id} --yes`);
331
+ else if (r.next)
332
+ lines.push("This reply does not specify the reset kind. Using a reset cannot be undone.", `To use it: flovia resets use ${r.next.id} --yes`);
330
333
  return lines.join("\n") + "\n";
331
334
  }
332
335
  export function renderConsent(c) {
@@ -519,7 +522,7 @@ export async function run(argv, io) {
519
522
  if (action === undefined) {
520
523
  if (p.flags.has("--yes"))
521
524
  throw new Usage("Usage: flovia resets use <id> --yes");
522
- const client = await connect(), r = await waitFor(() => client.bankedResets()), s = await waitFor(() => client.status());
525
+ const client = await connect(), [r, s] = await waitFor(() => Promise.all([client.bankedResets(), client.status()]));
523
526
  if (json)
524
527
  print({ ...r, five_hour: s.five_hour, week: s.week });
525
528
  else
@@ -535,7 +538,7 @@ export async function run(argv, io) {
535
538
  if (json)
536
539
  print(u);
537
540
  else
538
- out(u.outcome === "used" ? `Used. Both free windows (5-hour and week) start again from 0%.\n${label("saved resets")}${u.available}\n`
541
+ out(u.outcome === "used" ? `Used. The selected free allowance was reset; the monthly window is unchanged.\n${label("saved resets")}${u.available}\n`
539
542
  : `Not used; nothing changed.\n${label("saved resets")}${u.available}\nCheck: flovia resets\n`);
540
543
  return u.outcome === "used" ? 0 : 1;
541
544
  }
@@ -581,7 +584,7 @@ export async function run(argv, io) {
581
584
  return 0;
582
585
  }
583
586
  if ("outcome" in r)
584
- out(r.outcome === "set" ? "Set. A call over its key's cap is refused; nothing is sent or charged.\n" : "No active key with that id; nothing changed.\n");
587
+ out(r.outcome === "set" ? "Set. Caps limit this key’s use of purchased balance and plan credit. Eligible calls can still use the free allowance.\n" : "No active key with that id; nothing changed.\n");
585
588
  const usd = (v) => v === null ? "none" : `$${v}`;
586
589
  for (const k of r.keys)
587
590
  out(`${k.id} ${k.name}${k.last_four ? ` (…${k.last_four})` : ""}${k.current ? " [this key]" : ""}\n services: ${k.services === "all" ? "all" : k.services.join(", ")}\n`
@@ -596,8 +599,8 @@ export async function run(argv, io) {
596
599
  if (json)
597
600
  print({ mode: m });
598
601
  else
599
- out(m === "free_only" ? "spend mode: free-only. Calls use only the free allowance; past it they are refused and nothing is charged.\n"
600
- : "spend mode: allow-paid. Past the free allowance, plan credit or the purchased balance pays.\n");
602
+ out(m === "free_only" ? "spend mode: free-only. Metered calls need an available free allowance.\n"
603
+ : "spend mode: allow-paid. Plan credit or purchased balance may pay within your key caps.\n");
601
604
  return 0;
602
605
  }
603
606
  case "sandbox": {
@@ -783,7 +786,7 @@ export async function run(argv, io) {
783
786
  // The id is shown before anything is sent, so a lost reply can be reopened with it (never resent under a new one).
784
787
  if (fresh)
785
788
  err(`operation_id: ${id}\nSave it. To resend or reopen this request, use: --op ${id}\n`);
786
- err("This generation uses your free allowance first, then your purchased balance.\nIf the reply is lost, rerun with the same --op, prompt, output limit and effort.\nA saved answer may reopen free: up to 30 days from creation for notice 18 generations; earlier ones about 15 minutes. Missing or deleted copies are not restored. Never use a new id to recover an answer.\n");
789
+ err("What a new generation uses depends on your plan, available balance, spend mode and key caps.\nIf the reply is lost, rerun with the same --op, prompt, output limit and effort.\nA saved answer may reopen free: up to 30 days from creation for notice 18 generations; earlier ones about 15 minutes. Missing or deleted copies are not restored. Never use a new id to recover an answer.\n");
787
790
  if (!p.flags.has("--yes")) {
788
791
  if (io.confirm === null || text === "-")
789
792
  throw new Usage("generate: add --yes to send (no terminal to confirm on)");
@@ -1107,10 +1110,10 @@ if (isMain) {
1107
1110
  confirm: tty ? confirm : null,
1108
1111
  ...(process.stderr.isTTY ? { waiting: () => {
1109
1112
  const start = Date.now();
1110
- process.stderr.write("Waiting for Flovia.\n");
1111
- const timer = setInterval(() => process.stderr.write(`Waiting for Flovia (${Math.floor((Date.now() - start) / 1000)}s elapsed).\n`), 5000);
1113
+ process.stderr.write("\r\x1b[2KWaiting for Flovia.");
1114
+ const timer = setInterval(() => process.stderr.write(`\r\x1b[2KWaiting for Flovia (${Math.floor((Date.now() - start) / 1000)}s elapsed).`), 5000);
1112
1115
  timer.unref();
1113
- return () => clearInterval(timer);
1116
+ return () => { clearInterval(timer); process.stderr.write("\r\x1b[2K\n"); };
1114
1117
  } } : {}),
1115
1118
  });
1116
1119
  }
package/dist/client.d.ts CHANGED
@@ -39,7 +39,7 @@ export declare class FloviaClient {
39
39
  /** The account's saved resets: count and the first to expire. Read-only; nothing is used. */
40
40
  bankedResets(): Promise<BankedResets>;
41
41
  /**
42
- * Use one saved reset (its id from bankedResets()): both free windows, 5-hour and week, start again. Never resent automatically;
42
+ * Use one saved reset (its id from bankedResets()): its free window resets (a weekly coupon also resets 5-hour usage). Never resent automatically;
43
43
  * "not_used" means nothing changed. After a lost, refused (401) or unreadable reply, check bankedResets() before deciding to try again.
44
44
  */
45
45
  useBankedReset(grantId: number): Promise<BankedResetUse>;
@@ -53,8 +53,9 @@ export declare class FloviaClient {
53
53
  /** Each active key's own daily and monthly spending cap and its use (US dollars), and its services. Read-only. */
54
54
  keyCaps(): Promise<KeyCaps>;
55
55
  /**
56
- * Set one key's daily (UTC day) and monthly (UTC month) caps in US dollars, both at once; null removes one. A call over its key's cap is
57
- * refused (key_cap_reached) and nothing is sent or charged. Needs a key that allows all services. Setting caps is the account owner's own step.
56
+ * Set one key's daily (UTC day) and monthly (UTC month) caps in US dollars, both at once; null removes one.
57
+ * Caps limit use of purchased balance and plan credit. Eligible calls can still use the free allowance.
58
+ * Needs a key that allows all services. Setting caps is the account owner's own step.
58
59
  */
59
60
  setKeyCaps(keyId: string, caps: {
60
61
  day_usd: number | null;
package/dist/client.js CHANGED
@@ -189,10 +189,10 @@ export class FloviaClient {
189
189
  const body = await this.#account(r, null);
190
190
  if (!isResets(body))
191
191
  throw this.#error({ code: "invalid_reply", status: r.status, executed: "no", message: "The saved-reset reply was not in the expected form.", nextStep: null });
192
- return { available: body.available, next: body.next };
192
+ return { available: body.available, next: body.next, ...(body.resets === undefined ? {} : { resets: body.resets }) };
193
193
  }
194
194
  /**
195
- * Use one saved reset (its id from bankedResets()): both free windows, 5-hour and week, start again. Never resent automatically;
195
+ * Use one saved reset (its id from bankedResets()): its free window resets (a weekly coupon also resets 5-hour usage). Never resent automatically;
196
196
  * "not_used" means nothing changed. After a lost, refused (401) or unreadable reply, check bankedResets() before deciding to try again.
197
197
  */
198
198
  async useBankedReset(grantId) {
@@ -202,7 +202,7 @@ export class FloviaClient {
202
202
  const { r, body } = await this.#write("/account/banked-resets/use", { grant_id: grantId }, check);
203
203
  if (!isResets(body) || (body["outcome"] !== "used" && body["outcome"] !== "not_used"))
204
204
  throw this.#error({ code: "invalid_reply", status: r.status, executed: "unknown", message: "The saved-reset reply was not in the expected form.", nextStep: check });
205
- return { outcome: body["outcome"], available: body.available, next: body.next };
205
+ return { outcome: body["outcome"], available: body.available, next: body.next, ...(body.resets === undefined ? {} : { resets: body.resets }) };
206
206
  }
207
207
  /** The account's answer to Flovia's current notice and the notice text. Read-only; nothing is answered. */
208
208
  async consent() {
@@ -234,8 +234,9 @@ export class FloviaClient {
234
234
  return { keys: body["keys"] };
235
235
  }
236
236
  /**
237
- * Set one key's daily (UTC day) and monthly (UTC month) caps in US dollars, both at once; null removes one. A call over its key's cap is
238
- * refused (key_cap_reached) and nothing is sent or charged. Needs a key that allows all services. Setting caps is the account owner's own step.
237
+ * Set one key's daily (UTC day) and monthly (UTC month) caps in US dollars, both at once; null removes one.
238
+ * Caps limit use of purchased balance and plan credit. Eligible calls can still use the free allowance.
239
+ * Needs a key that allows all services. Setting caps is the account owner's own step.
239
240
  */
240
241
  async setKeyCaps(keyId, caps) {
241
242
  // The relay's own rule: whole cents, $0 to $1,000,000.
@@ -468,6 +469,9 @@ const count = (v, min) => typeof v === "number" && Number.isSafeInteger(v) && v
468
469
  /** The saved-reset summary's exact public form. */
469
470
  function isResets(b) {
470
471
  const next = b["next"];
472
+ const resets = b["resets"];
473
+ if (resets !== undefined && (!Array.isArray(resets) || resets.length > 2 || !resets.every(r => r && typeof r === "object" && !Array.isArray(r) && count(r.id, 1) && ["five_hour", "week"].includes(r.kind) && typeof r.expires_at === "string" && !Number.isNaN(Date.parse(r.expires_at)))))
474
+ return false;
471
475
  return count(b["available"], 0) && (next === null || (typeof next === "object" && !Array.isArray(next) && count(next["id"], 1)
472
476
  && typeof next["expires_at"] === "string" && !Number.isNaN(Date.parse(next["expires_at"])))) && (next === null) === (b["available"] === 0);
473
477
  }
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /** The relay's tool contract this SDK was written against (flovia_status.contract_version). */
2
- export declare const EXPECTED_CONTRACT_VERSION = "2026-10-07.208";
2
+ export declare const EXPECTED_CONTRACT_VERSION = "2026-10-07.217";
3
3
  /** Every public explanation.code (the relay's contract). A provider's own HTTP error is `http_<status>`. */
4
- export declare const PUBLIC_CODES: readonly ["approval_pending", "key_disabled", "key_stopped", "team_stopped", "consent_missing", "data_consent_mismatch", "data_consent_needed", "notice_first", "elevenlabs_terms_required", "provider_not_allowed", "account_key_required", "endpoint_unknown", "endpoint_disabled", "read_only", "not_relayed", "key_in_query", "secret_in_input", "invalid_body", "body_too_large", "answer_too_large", "answer_precision_unsafe", "answer_not_relayed", "request_text_too_long", "over_max_credits", "window_5h", "window_month", "window_week", "over_week", "free_only_exhausted", "key_cap_reached", "member_cap_reached", "team_balance_empty", "free_limited", "free_needs_email", "free_not_granted", "global_cap", "flovia_paused", "rate_limited", "too_many_in_parallel", "reservation_changed", "operation_conflict", "operation_pending", "relay_internal_error", "relay_internal_unknown", "upstream_unknown", "cannot_summarize", "upstream_unavailable", "page_tls_invalid", "page_unreachable", "replay_response_unavailable", "rpc_error", "unknown_lookup", "invalid_cursor", "since_too_old", "since_in_future", "feedback_too_long", "feedback_limit", "not_configured", "service_off", "queue_full", "input_unavailable", "sandbox_disabled", "team_feature_off"];
4
+ export declare const PUBLIC_CODES: readonly ["approval_pending", "key_disabled", "key_stopped", "team_stopped", "consent_missing", "data_consent_mismatch", "data_consent_needed", "notice_first", "elevenlabs_terms_required", "provider_not_allowed", "account_key_required", "endpoint_unknown", "endpoint_disabled", "read_only", "not_relayed", "key_in_query", "secret_in_input", "invalid_body", "body_too_large", "answer_too_large", "answer_precision_unsafe", "answer_not_relayed", "request_text_too_long", "over_max_credits", "window_5h", "window_month", "window_week", "over_week", "free_only_exhausted", "key_cap_reached", "member_cap_reached", "team_balance_empty", "free_limited", "free_needs_email", "free_not_granted", "global_cap", "flovia_paused", "rate_limited", "too_many_in_parallel", "reservation_changed", "operation_conflict", "operation_pending", "relay_internal_error", "relay_internal_unknown", "upstream_unknown", "cannot_summarize", "upstream_unavailable", "page_tls_invalid", "page_unreachable", "replay_response_unavailable", "rpc_error", "unknown_lookup", "invalid_cursor", "since_too_old", "since_in_future", "feedback_too_long", "feedback_limit", "not_configured", "service_off", "queue_full", "input_unavailable", "sandbox_disabled", "team_feature_off", "purchase_refused", "team_purchase_not_supported"];
5
5
  export type FloviaCode = (typeof PUBLIC_CODES)[number] | `http_${number}`;
6
6
  /** Whether the request ran upstream: "unknown" means keep the same operation_id and never send a replacement. */
7
7
  export type Executed = "yes" | "no" | "unknown";
@@ -48,7 +48,7 @@ export interface Window {
48
48
  resets_at: string | null;
49
49
  }
50
50
  export type StatusArgs = {
51
- about_sharing?: true;
51
+ about_sharing?: boolean;
52
52
  };
53
53
  export interface StatusReply extends ToolReply {
54
54
  contract_version: string;
@@ -58,7 +58,7 @@ export interface StatusReply extends ToolReply {
58
58
  services_off: string[];
59
59
  }
60
60
  export interface UsageTodayArgs {
61
- /** ISO 8601 time, at most 30 days ago (relays before #2641: 7 days). */
61
+ /** ISO 8601 time or YYYY-MM-DD (00:00 UTC), at most 30 days ago (relays before #2641: 7 days). */
62
62
  since?: string;
63
63
  /** The last N days (1-30) instead of since; not with since or a cursor. Relays before #2641 refuse it. */
64
64
  days?: number;
@@ -75,7 +75,8 @@ export interface UsageTodayReply extends ToolReply {
75
75
  }
76
76
  /** POST /openai/v1/responses: an OpenAI Responses request, text only. Unknown fields are refused. */
77
77
  export interface GenerationRequest {
78
- model: "gpt-6-luna";
78
+ /** gpt-6-luna is the default; gpt-6.2-astra and gpt-6.2-sol answer only where the relay offers them, and refuse effort none. */
79
+ model: "gpt-6-luna" | "gpt-6.2-astra" | "gpt-6.2-sol";
79
80
  input: string;
80
81
  max_output_tokens?: number;
81
82
  reasoning?: {
@@ -103,15 +104,20 @@ export interface Generation {
103
104
  receivedAt: string | null;
104
105
  conversationId: string | null;
105
106
  }
106
- /** GET /account/banked-resets: saved resets that can still be used, and the first to expire. */
107
+ /** GET /account/banked-resets: saved resets that can still be used, the first to expire, and (new relays) one choice per kind. */
107
108
  export interface BankedResets {
108
109
  available: number;
109
110
  next: {
110
111
  id: number;
111
112
  expires_at: string;
112
113
  } | null;
114
+ resets?: {
115
+ id: number;
116
+ kind: "five_hour" | "week";
117
+ expires_at: string;
118
+ }[];
113
119
  }
114
- /** "used": both free windows (5-hour and week) start again. "not_used": nothing changed (already used, expired, a lookup still settling, or nothing to reset). */
120
+ /** "used": the selected coupon resets its free window (weekly also resets 5-hour usage). "not_used": nothing changed (already used, expired, a lookup still settling, or nothing to reset). */
115
121
  export interface BankedResetUse extends BankedResets {
116
122
  outcome: "used" | "not_used";
117
123
  }
package/dist/types.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /** The relay's tool contract this SDK was written against (flovia_status.contract_version). */
2
- export const EXPECTED_CONTRACT_VERSION = "2026-10-07.208";
2
+ export const EXPECTED_CONTRACT_VERSION = "2026-10-07.217";
3
3
  /** Every public explanation.code (the relay's contract). A provider's own HTTP error is `http_<status>`. */
4
4
  export const PUBLIC_CODES = [
5
5
  "approval_pending", "key_disabled", "key_stopped", "team_stopped", "consent_missing", "data_consent_mismatch", "data_consent_needed", "notice_first",
@@ -10,4 +10,5 @@ export const PUBLIC_CODES = [
10
10
  "operation_conflict", "operation_pending", "relay_internal_error", "relay_internal_unknown", "upstream_unknown", "cannot_summarize", "upstream_unavailable", "page_tls_invalid", "page_unreachable", "replay_response_unavailable", "rpc_error",
11
11
  "unknown_lookup", "invalid_cursor", "since_too_old", "since_in_future", "feedback_too_long", "feedback_limit", "not_configured", "service_off",
12
12
  "queue_full", "input_unavailable", "sandbox_disabled", "team_feature_off",
13
+ "purchase_refused", "team_purchase_not_supported",
13
14
  ];
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@flovialabs/sdk",
3
- "version": "0.1.22",
3
+ "version": "0.1.24",
4
4
  "type": "module",
5
5
  "description": "TypeScript client and CLI for Flovia: MCP tools over HTTP and OpenAI-compatible generation. Zero dependencies.",
6
6
  "license": "MIT",
7
- "homepage": "https://api.flovia.dev",
7
+ "homepage": "https://docs.flovia.dev",
8
+ "bugs": {
9
+ "url": "https://flovia.dev/contact"
10
+ },
8
11
  "repository": {
9
12
  "type": "git",
10
13
  "url": "git+https://github.com/flovia/groupbuy.git",