@flovialabs/sdk 0.1.2 → 0.1.4
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 +9 -0
- package/README.md +11 -7
- package/dist/cli.js +13 -5
- package/dist/client.js +18 -11
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/types.d.ts +4 -2
- package/dist/types.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.4
|
|
4
|
+
|
|
5
|
+
- Luna generation accepts `reasoning.effort` values `none`, `low`, `medium`, `high`, `xhigh` and `max`. The default remains `none`.
|
|
6
|
+
- CLI `generate --reasoning-effort LEVEL` selects the effort. Lost-reply recovery keeps that option unchanged along with the operation id, input and output limit; it never retries automatically.
|
|
7
|
+
|
|
8
|
+
## 0.1.3
|
|
9
|
+
|
|
10
|
+
- Redact the configured API key when it is echoed in SDK errors, recovery metadata, diagnostic reply fields or contract warnings.
|
|
11
|
+
|
|
3
12
|
## 0.1.2
|
|
4
13
|
|
|
5
14
|
- CLI status distinguishes a successful connection from declined sharing, withdrawal, stopped keys and consent that needs an answer.
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ 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.
|
|
13
|
+
npm install --save-exact @flovialabs/sdk@0.1.4
|
|
14
14
|
```
|
|
15
15
|
|
|
16
16
|
## Your key
|
|
@@ -47,7 +47,7 @@ const reply = await flovia.call("flovia_status");
|
|
|
47
47
|
|
|
48
48
|
// A text generation (uses credits). Save the operation id before sending.
|
|
49
49
|
const op = newOperationId();
|
|
50
|
-
const request = { model: "gpt-6-luna" as const, input: "Explain a DEX aggregator in one sentence." };
|
|
50
|
+
const request = { model: "gpt-6-luna" as const, input: "Explain a DEX aggregator in one sentence.", reasoning: { effort: "low" as const } };
|
|
51
51
|
// Persist { op, request } in your application's private storage before the next line.
|
|
52
52
|
const g = await flovia.generate(request, { operationId: op });
|
|
53
53
|
console.log(g.response.status, g.response.incomplete_details, g.outputText);
|
|
@@ -72,6 +72,10 @@ const price = await flovia.call("flovia_coingecko", priceRequest);
|
|
|
72
72
|
|
|
73
73
|
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.
|
|
74
74
|
|
|
75
|
+
### Thinking effort
|
|
76
|
+
|
|
77
|
+
For Luna, set `reasoning.effort` to `none`, `low`, `medium`, `high`, `xhigh` or `max`; omitting it keeps Flovia's `none` default. Higher effort can take longer and use more reasoning tokens. Those tokens share `max_output_tokens` with the visible answer, so an answer may be shorter or `incomplete`. The default output limit remains 1,000, with an explicit maximum of 4,000. Effort does not raise Flovia's per-request spending cap or guarantee a better answer. Save the effort with the rest of the request; changing it under the same operation id is a different request and is refused.
|
|
78
|
+
|
|
75
79
|
### Operation ids and replay
|
|
76
80
|
|
|
77
81
|
`generate()` requires an operation id (8-128 characters of `A-Z a-z 0-9 _ . : -`). Create one with `newOperationId()` and store it with the request **before** sending.
|
|
@@ -130,22 +134,22 @@ npx flovia usage --days 3
|
|
|
130
134
|
npx flovia tools
|
|
131
135
|
npx flovia tools --json # includes each tool's inputSchema
|
|
132
136
|
npx flovia call flovia_usage_today '{}'
|
|
133
|
-
npx flovia generate --op sdk-example-0001 --max-output
|
|
137
|
+
npx flovia generate --op sdk-example-0001 --max-output 1000 --reasoning-effort low "Explain a DEX aggregator."
|
|
134
138
|
# Only to reopen that exact request within about 15 minutes (not a new generation):
|
|
135
|
-
npx flovia generate --op sdk-example-0001 --max-output
|
|
139
|
+
npx flovia generate --op sdk-example-0001 --max-output 1000 --reasoning-effort low --yes "Explain a DEX aggregator."
|
|
136
140
|
npx flovia help
|
|
137
141
|
npx flovia --version
|
|
138
142
|
```
|
|
139
|
-
These commands run after installing `@flovialabs/sdk` in the current project. Without a local installation, specify the package: `npx --package=@flovialabs/sdk@0.1.
|
|
143
|
+
These commands run after installing `@flovialabs/sdk` in the current project. Without a local installation, specify the package: `npx --package=@flovialabs/sdk@0.1.4 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.
|
|
140
144
|
|
|
141
145
|
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.
|
|
142
146
|
|
|
143
147
|
For multiline text, keep the original input in a private file:
|
|
144
148
|
|
|
145
149
|
```sh
|
|
146
|
-
flovia generate --new-op --max-output
|
|
150
|
+
flovia generate --new-op --max-output 1000 --reasoning-effort high --yes - < prompt.txt
|
|
147
151
|
# To recover this request, use its printed id, the SAME file and options:
|
|
148
|
-
flovia generate --op <saved-id> --max-output
|
|
152
|
+
flovia generate --op <saved-id> --max-output 1000 --reasoning-effort high --yes - < prompt.txt
|
|
149
153
|
```
|
|
150
154
|
|
|
151
155
|
Keep the same `--key-file` and `--base-url` too. For a prompt starting with a hyphen, use `--` before the prompt. Long answers can take minutes; an interactive terminal shows elapsed time on stderr. Piped and JSON output stays unchanged. A timeout does not prove that nothing ran: never recover by repeating `--new-op`. Partial answers are delivered and settled, but the CLI never generates a continuation automatically. The HTTP reply does not include exact Flovia cost; use `flovia usage` for period totals, which are not the price of this one answer. A replay adds no charge.
|
package/dist/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ const COMMANDS = {
|
|
|
16
16
|
usage: { usage: "usage [--since ISO | --days N] [--cursor C]", about: "lookups and generations (today, or since a time within 7 days)", flags: { "--since": true, "--days": true, "--cursor": true } },
|
|
17
17
|
tools: { usage: "tools", about: "the tools this key is offered", flags: {} },
|
|
18
18
|
call: { usage: "call <tool> ['<json args>']", about: "call any tool and print its reply", flags: {} },
|
|
19
|
-
generate: { usage: "generate (--op ID | --new-op) [--max-output N] [--yes] <prompt | ->", about: "a text generation (uses credits)", flags: { "--op": true, "--new-op": false, "--max-output": true, "--yes": false } },
|
|
19
|
+
generate: { usage: "generate (--op ID | --new-op) [--max-output N]\n [--reasoning-effort LEVEL] [--yes] <prompt | ->", about: "a text generation (uses credits)", flags: { "--op": true, "--new-op": false, "--max-output": true, "--reasoning-effort": true, "--yes": false } },
|
|
20
20
|
help: { usage: "help [command]", about: "this help", flags: {} },
|
|
21
21
|
version: { usage: "version", about: "the installed CLI version", flags: {} },
|
|
22
22
|
};
|
|
@@ -41,7 +41,7 @@ export function help(command) {
|
|
|
41
41
|
...Object.values(COMMANDS).flatMap((x) => [` ${x.usage}`, ` ${x.about}`])] : [`Usage: flovia ${c.usage}`, ` ${c.about}`];
|
|
42
42
|
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. Never paste the key into a command argument.");
|
|
43
43
|
if (command === "generate")
|
|
44
|
-
lines.push("", "Default output limit: 1000 tokens; maximum: 4000.", "Long answers can take minutes. Save the id, same input
|
|
44
|
+
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.");
|
|
45
45
|
if (command === "tools" || c === undefined)
|
|
46
46
|
lines.push("", "Inspect tool arguments: flovia tools --json", "Read-only example: flovia call flovia_status '{}'");
|
|
47
47
|
lines.push("", "Default base URL: https://api.flovia.dev.", "Exit codes: 0 ok, 1 relay error, 2 usage error.", "");
|
|
@@ -96,6 +96,11 @@ function positiveInt(name, v, max = Number.MAX_SAFE_INTEGER) {
|
|
|
96
96
|
throw new Usage(`${name} must be a whole number from 1 to ${max}`);
|
|
97
97
|
return n;
|
|
98
98
|
}
|
|
99
|
+
function reasoningEffort(v) {
|
|
100
|
+
if (v === undefined || v === "none" || v === "low" || v === "medium" || v === "high" || v === "xhigh" || v === "max")
|
|
101
|
+
return v;
|
|
102
|
+
throw new Usage("--reasoning-effort must be one of: none, low, medium, high, xhigh, max");
|
|
103
|
+
}
|
|
99
104
|
/** The key from --key-file (trimmed) or FLOVIA_KEY. Its text never goes into a message. */
|
|
100
105
|
async function readKey(p, io) {
|
|
101
106
|
const file = str(p.flags.get("--key-file"));
|
|
@@ -242,6 +247,7 @@ export async function run(argv, io) {
|
|
|
242
247
|
const json = p.flags.has("--json"), print = (v) => out(JSON.stringify(v, null, 2) + "\n");
|
|
243
248
|
let mismatch = null;
|
|
244
249
|
let recoveryLimit;
|
|
250
|
+
let recoveryEffort;
|
|
245
251
|
try {
|
|
246
252
|
const timeout = positiveInt("--timeout", str(p.flags.get("--timeout")));
|
|
247
253
|
const baseUrl = str(p.flags.get("--base-url"));
|
|
@@ -311,12 +317,14 @@ export async function run(argv, io) {
|
|
|
311
317
|
if (input.trim() === "")
|
|
312
318
|
throw new Usage("generate: the prompt is empty");
|
|
313
319
|
const max = positiveInt("--max-output", str(p.flags.get("--max-output")));
|
|
320
|
+
const effort = reasoningEffort(str(p.flags.get("--reasoning-effort")));
|
|
314
321
|
recoveryLimit = max;
|
|
322
|
+
recoveryEffort = effort;
|
|
315
323
|
const id = op ?? newOperationId();
|
|
316
324
|
// The id is shown before anything is sent, so a lost reply can be reopened with it (never resent under a new one).
|
|
317
325
|
if (fresh)
|
|
318
326
|
err(`operation_id: ${id}\nSave it. To resend or reopen this request, use: --op ${id}\n`);
|
|
319
|
-
err("This generation uses Flovia credits (usage allowance first, then bought credits).\nSame --op, same input
|
|
327
|
+
err("This generation uses Flovia credits (usage allowance first, then bought credits).\nSame --op, same input, output limit and effort: saved answers are free for about 15 minutes.\nPending, unknown or expired answers: never replace them with a new id.\n");
|
|
320
328
|
if (!p.flags.has("--yes")) {
|
|
321
329
|
if (io.confirm === null || text === "-")
|
|
322
330
|
throw new Usage("generate: add --yes to send (no terminal to confirm on)");
|
|
@@ -328,7 +336,7 @@ export async function run(argv, io) {
|
|
|
328
336
|
const stopWaiting = json ? undefined : io.waiting?.();
|
|
329
337
|
let g;
|
|
330
338
|
try {
|
|
331
|
-
g = await client.generate({ model: "gpt-6-luna", input, ...(max ? { max_output_tokens: max } : {}) }, { operationId: id });
|
|
339
|
+
g = await client.generate({ model: "gpt-6-luna", input, ...(max ? { max_output_tokens: max } : {}), ...(effort ? { reasoning: { effort } } : {}) }, { operationId: id });
|
|
332
340
|
}
|
|
333
341
|
finally {
|
|
334
342
|
stopWaiting?.();
|
|
@@ -363,7 +371,7 @@ export async function run(argv, io) {
|
|
|
363
371
|
print(e.reply);
|
|
364
372
|
err(renderError(e));
|
|
365
373
|
if (p.command === "generate" && e.operationId && e.executed === "unknown")
|
|
366
|
-
err(`Recovery: keep the same input
|
|
374
|
+
err(`Recovery: keep the same input, ${recoveryLimit === undefined ? "omit --max-output as before" : `--max-output ${recoveryLimit}`} and ${recoveryEffort === undefined ? "omit --reasoning-effort as before" : `--reasoning-effort ${recoveryEffort}`} with --op ${e.operationId}.\nUse the original prompt file and the same --key-file / --base-url.\nDo not rerun --new-op or create a different request to recover this answer.\n`);
|
|
367
375
|
return e.code === "invalid_base_url" ? 2 : 1;
|
|
368
376
|
}
|
|
369
377
|
err(`error: ${e instanceof Error ? e.message : String(e)}\n`);
|
package/dist/client.js
CHANGED
|
@@ -14,7 +14,7 @@ const seconds = (v) => {
|
|
|
14
14
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
15
15
|
const SAME_OPERATION = "Resend with the same operation_id; do not use a new one.";
|
|
16
16
|
/** A lost or unreadable reply cannot prove that the operation did not run. */
|
|
17
|
-
async function readReply(r, operationId, sse = false) {
|
|
17
|
+
async function readReply(r, operationId, makeError, sse = false) {
|
|
18
18
|
try {
|
|
19
19
|
const text = (await r.text()).trimStart();
|
|
20
20
|
const payload = sse && !text.startsWith("{") ? text.split(/\r?\n/).filter((l) => l.startsWith("data:"))
|
|
@@ -26,7 +26,7 @@ async function readReply(r, operationId, sse = false) {
|
|
|
26
26
|
}
|
|
27
27
|
catch (cause) {
|
|
28
28
|
const timeout = cause instanceof Error && cause.name === "TimeoutError";
|
|
29
|
-
throw
|
|
29
|
+
throw makeError({ code: timeout ? "timeout" : `http_${r.status}`, status: r.status, executed: "unknown", operationId,
|
|
30
30
|
message: timeout ? "Timed out while reading the reply." : `Unexpected reply (HTTP ${r.status}).`, nextStep: operationId ? SAME_OPERATION : null });
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -62,6 +62,13 @@ export class FloviaClient {
|
|
|
62
62
|
// eslint-disable-next-line no-console -- versions only, never the key
|
|
63
63
|
this.#onMismatch = options.onContractMismatch ?? ((expected, actual) => console.warn(`Flovia contract ${actual} differs from the SDK's ${expected}; check flovia_status recent_updates.`));
|
|
64
64
|
}
|
|
65
|
+
/** Mask only this client's exact key in diagnostic strings and reply field names; keep Error field names intact. */
|
|
66
|
+
#error(init) {
|
|
67
|
+
const scrub = (text) => text.replaceAll(this.#key, "[key]");
|
|
68
|
+
const safe = JSON.parse(JSON.stringify(init, (_name, value) => typeof value === "string" ? scrub(value) : value !== init && value !== null && typeof value === "object" && !Array.isArray(value)
|
|
69
|
+
? Object.fromEntries(Object.entries(value).map(([name, field]) => [scrub(name), field])) : value));
|
|
70
|
+
return new FloviaError(safe);
|
|
71
|
+
}
|
|
65
72
|
/** One HTTP request. A network failure or timeout is executed "unknown": the relay may have received it. */
|
|
66
73
|
async #send(path, body, headers = {}, operationId = null) {
|
|
67
74
|
let r;
|
|
@@ -73,7 +80,7 @@ export class FloviaClient {
|
|
|
73
80
|
catch (cause) {
|
|
74
81
|
const timeout = cause instanceof Error && cause.name === "TimeoutError";
|
|
75
82
|
// Transport diagnostics may contain request headers, so never attach their raw cause.
|
|
76
|
-
throw
|
|
83
|
+
throw this.#error({ code: timeout ? "timeout" : "network_error", executed: "unknown", operationId,
|
|
77
84
|
message: timeout ? `No reply within ${this.#timeoutMs} ms.` : "The request did not complete.",
|
|
78
85
|
nextStep: operationId ? SAME_OPERATION : null });
|
|
79
86
|
}
|
|
@@ -83,9 +90,9 @@ export class FloviaClient {
|
|
|
83
90
|
}
|
|
84
91
|
async #rpc(method, params, operationId = null) {
|
|
85
92
|
const r = await this.#send("/mcp", { jsonrpc: "2.0", id: ++this.#id, method, ...(params ? { params } : {}) }, { Accept: "application/json, text/event-stream", "MCP-Protocol-Version": "2025-06-18" }, operationId);
|
|
86
|
-
const message = await readReply(r, operationId, true);
|
|
93
|
+
const message = await readReply(r, operationId, init => this.#error(init), true);
|
|
87
94
|
if (message.error !== undefined || message.result === null || typeof message.result !== "object" || Array.isArray(message.result))
|
|
88
|
-
throw
|
|
95
|
+
throw this.#error({ code: "mcp_error", status: r.status, executed: "unknown", operationId,
|
|
89
96
|
message: String(message.error?.message ?? "No result."), nextStep: operationId ? SAME_OPERATION : null });
|
|
90
97
|
return message.result;
|
|
91
98
|
}
|
|
@@ -113,7 +120,7 @@ export class FloviaClient {
|
|
|
113
120
|
}
|
|
114
121
|
}
|
|
115
122
|
catch {
|
|
116
|
-
throw
|
|
123
|
+
throw this.#error({ code: "tool_error", executed: "unknown", operationId, nextStep: operationId ? SAME_OPERATION : null,
|
|
117
124
|
message: result.isError ? "The tool failed." : "The tool reply is not JSON." });
|
|
118
125
|
}
|
|
119
126
|
const e = reply.explanation;
|
|
@@ -125,7 +132,7 @@ export class FloviaClient {
|
|
|
125
132
|
await sleep(Math.max(1, wait ?? 0) * 1000);
|
|
126
133
|
continue;
|
|
127
134
|
}
|
|
128
|
-
throw
|
|
135
|
+
throw this.#error({ code: e.code, message: e.meaning, nextStep: e.next_step, executed: e.executed, retryAfterSeconds: wait, operationId, reply });
|
|
129
136
|
}
|
|
130
137
|
}
|
|
131
138
|
/** flovia_status. Warns once when the relay's contract_version is not the one this SDK expects. */
|
|
@@ -133,7 +140,7 @@ export class FloviaClient {
|
|
|
133
140
|
const s = await this.call("flovia_status");
|
|
134
141
|
if (!this.#warned && s.contract_version !== EXPECTED_CONTRACT_VERSION) {
|
|
135
142
|
this.#warned = true;
|
|
136
|
-
this.#onMismatch(EXPECTED_CONTRACT_VERSION, s.contract_version);
|
|
143
|
+
this.#onMismatch(EXPECTED_CONTRACT_VERSION, String(s.contract_version).replaceAll(this.#key, "[key]"));
|
|
137
144
|
}
|
|
138
145
|
return s;
|
|
139
146
|
}
|
|
@@ -151,9 +158,9 @@ export class FloviaClient {
|
|
|
151
158
|
if (!OPERATION_ID.test(op))
|
|
152
159
|
throw new FloviaError({ code: "invalid_operation_id", executed: "no", message: "operationId must be 8-128 of A-Z a-z 0-9 _ . : -" });
|
|
153
160
|
const r = await this.#send("/openai/v1/responses", request, { "Flovia-Operation-Id": op, ...(options.conversationId ? { "Flovia-Conversation-Id": options.conversationId } : {}) }, op);
|
|
154
|
-
const body = await readReply(r, op);
|
|
161
|
+
const body = await readReply(r, op, init => this.#error(init));
|
|
155
162
|
if (r.status === 200 && !Array.isArray(body["output"]))
|
|
156
|
-
throw
|
|
163
|
+
throw this.#error({ code: "http_200", status: 200, executed: "unknown", operationId: op, message: "Unexpected generation reply (HTTP 200).", nextStep: SAME_OPERATION });
|
|
157
164
|
if (r.status === 200)
|
|
158
165
|
return { response: body, outputText: outputText(body), generationId: r.headers.get("Flovia-Generation-Id"),
|
|
159
166
|
replayed: r.headers.get("Flovia-Replayed") === "1", receivedAt: r.headers.get("Flovia-Received-At"), conversationId: r.headers.get("Flovia-Conversation-Id") };
|
|
@@ -161,7 +168,7 @@ export class FloviaClient {
|
|
|
161
168
|
const code = typeof err === "string" ? err : String(err?.code ?? `http_${r.status}`);
|
|
162
169
|
const message = String(err?.message ?? body["message"] ?? `HTTP ${r.status}`);
|
|
163
170
|
const executed = explanation?.executed ?? generationExecuted(code);
|
|
164
|
-
throw
|
|
171
|
+
throw this.#error({ code, message, status: r.status, operationId: op, reply: body,
|
|
165
172
|
executed, nextStep: explanation?.next_step ?? (executed === "unknown" ? SAME_OPERATION : null),
|
|
166
173
|
retryAfterSeconds: seconds(r.headers.get("Retry-After")) ?? seconds(body["retry_after_seconds"]) });
|
|
167
174
|
}
|
package/dist/errors.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare class FloviaError extends Error {
|
|
|
11
11
|
readonly status: number | null;
|
|
12
12
|
readonly retryAfterSeconds: number | null;
|
|
13
13
|
readonly operationId: string | null;
|
|
14
|
-
/** The
|
|
14
|
+
/** The reply body with configured-key echoes redacted, including fields such as user_notice or consent.question. */
|
|
15
15
|
readonly reply: ToolReply | null;
|
|
16
16
|
constructor(init: {
|
|
17
17
|
code: string;
|
package/dist/errors.js
CHANGED
|
@@ -10,7 +10,7 @@ export class FloviaError extends Error {
|
|
|
10
10
|
status;
|
|
11
11
|
retryAfterSeconds;
|
|
12
12
|
operationId;
|
|
13
|
-
/** The
|
|
13
|
+
/** The reply body with configured-key echoes redacted, including fields such as user_notice or consent.question. */
|
|
14
14
|
reply;
|
|
15
15
|
constructor(init) {
|
|
16
16
|
super(init.message, init.cause === undefined ? undefined : { cause: init.cause });
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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.
|
|
2
|
+
export declare const EXPECTED_CONTRACT_VERSION = "2026-10-07.120";
|
|
3
3
|
/** Every public explanation.code (the relay's contract). A provider's own HTTP error is `http_<status>`. */
|
|
4
4
|
export declare const PUBLIC_CODES: readonly ["key_disabled", "key_stopped", "consent_missing", "data_consent_mismatch", "data_consent_needed", "notice_first", "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", "cost_confirmation_needed", "window_5h", "window_week", "over_week", "free_limited", "free_needs_email", "global_cap", "flovia_paused", "free_paused", "rate_limited", "too_many_in_parallel", "reservation_changed", "operation_conflict", "operation_pending", "upstream_unknown", "upstream_unavailable", "replay_response_unavailable", "rpc_error", "unknown_lookup", "invalid_cursor", "since_too_old", "since_in_future", "feedback_too_long", "feedback_limit", "not_configured", "service_off"];
|
|
5
5
|
export type FloviaCode = (typeof PUBLIC_CODES)[number] | `http_${number}`;
|
|
@@ -39,6 +39,8 @@ export interface UsageTodayArgs {
|
|
|
39
39
|
since?: string;
|
|
40
40
|
/** The previous next_cursor, unchanged, with the same since and conversation. */
|
|
41
41
|
cursor?: string;
|
|
42
|
+
/** The previous generations.next_cursor, with the same since and conversation. */
|
|
43
|
+
generation_cursor?: string;
|
|
42
44
|
/** Only this conversation's lookups. */
|
|
43
45
|
conversation?: string;
|
|
44
46
|
}
|
|
@@ -52,7 +54,7 @@ export interface GenerationRequest {
|
|
|
52
54
|
input: string;
|
|
53
55
|
max_output_tokens?: number;
|
|
54
56
|
reasoning?: {
|
|
55
|
-
effort: "none" | "low";
|
|
57
|
+
effort: "none" | "low" | "medium" | "high" | "xhigh" | "max";
|
|
56
58
|
};
|
|
57
59
|
stream?: false;
|
|
58
60
|
store?: false;
|
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.
|
|
2
|
+
export const EXPECTED_CONTRACT_VERSION = "2026-10-07.120";
|
|
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
|
"key_disabled", "key_stopped", "consent_missing", "data_consent_mismatch", "data_consent_needed", "notice_first",
|
package/package.json
CHANGED