@wice24/tars-sdk 0.1.7 → 0.1.8
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/dist/index.d.ts +15 -1
- package/dist/index.js +17 -0
- package/dist/types.d.ts +18 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Agent, AgentVersion, ClientTool, CreateAgentInput, FileMeta, McpCredentialInput, McpCredentialStatus, SessionEvent, SessionInfo, SessionListItem, UpdateAgentInput, UploadFileInput, UsageSummary, SessionUsageRow, DailyUsageRow, McpServer, Skill, SkillVersion, ApiKeyInfo, ClientIdentity, ClientRole, PlatformStats, Tenant } from './types.js';
|
|
1
|
+
import type { Agent, AgentVersion, ClientTool, CreateAgentInput, FileMeta, McpCredentialInput, McpCredentialStatus, SessionEvent, ModelInfo, SessionInfo, SessionListItem, UpdateAgentInput, UploadFileInput, UsageSummary, SessionUsageRow, DailyUsageRow, McpServer, Skill, SkillVersion, ApiKeyInfo, ClientIdentity, ClientRole, PlatformStats, Tenant } from './types.js';
|
|
2
2
|
type ToolHandler = (input: any) => unknown | Promise<unknown>;
|
|
3
3
|
export * from './types.js';
|
|
4
4
|
export declare class TarsApiError extends Error {
|
|
@@ -202,6 +202,20 @@ export declare class TarsClient {
|
|
|
202
202
|
* the provider call.
|
|
203
203
|
*/
|
|
204
204
|
providers(): Promise<string[]>;
|
|
205
|
+
/**
|
|
206
|
+
* The models this instance can route AND price — ids are full
|
|
207
|
+
* `provider/model` specs. `openrouter/*` entries mirror OpenRouter's live
|
|
208
|
+
* catalog, so those ids are guaranteed to exist right now; direct entries
|
|
209
|
+
* come from the deployment's curated pricing table. Offer models from this
|
|
210
|
+
* list rather than hardcoding ids that can drift.
|
|
211
|
+
*
|
|
212
|
+
* The list is "what is known now", not "everything routable": `openrouter`
|
|
213
|
+
* entries are absent before the instance's first successful catalog
|
|
214
|
+
* refresh, and a deployment routing only `custom/*` has no priced entries
|
|
215
|
+
* at all. When it comes back empty, fall back to `providers()` plus your
|
|
216
|
+
* own lineup instead of rendering an empty picker.
|
|
217
|
+
*/
|
|
218
|
+
models(): Promise<ModelInfo[]>;
|
|
205
219
|
readonly usage: {
|
|
206
220
|
get: (filter?: {
|
|
207
221
|
from?: string | Date;
|
package/dist/index.js
CHANGED
|
@@ -228,6 +228,23 @@ export class TarsClient {
|
|
|
228
228
|
const body = await this.request('GET', '/v1/providers');
|
|
229
229
|
return body.providers ?? [];
|
|
230
230
|
}
|
|
231
|
+
/**
|
|
232
|
+
* The models this instance can route AND price — ids are full
|
|
233
|
+
* `provider/model` specs. `openrouter/*` entries mirror OpenRouter's live
|
|
234
|
+
* catalog, so those ids are guaranteed to exist right now; direct entries
|
|
235
|
+
* come from the deployment's curated pricing table. Offer models from this
|
|
236
|
+
* list rather than hardcoding ids that can drift.
|
|
237
|
+
*
|
|
238
|
+
* The list is "what is known now", not "everything routable": `openrouter`
|
|
239
|
+
* entries are absent before the instance's first successful catalog
|
|
240
|
+
* refresh, and a deployment routing only `custom/*` has no priced entries
|
|
241
|
+
* at all. When it comes back empty, fall back to `providers()` plus your
|
|
242
|
+
* own lineup instead of rendering an empty picker.
|
|
243
|
+
*/
|
|
244
|
+
async models() {
|
|
245
|
+
const body = await this.request('GET', '/v1/models');
|
|
246
|
+
return body.models ?? [];
|
|
247
|
+
}
|
|
231
248
|
// ── usage ────────────────────────────────────────────────────
|
|
232
249
|
usage = {
|
|
233
250
|
// Aggregated token/cost usage for this tenant, with per-model, per-agent,
|
package/dist/types.d.ts
CHANGED
|
@@ -129,6 +129,24 @@ export interface SkillVersion {
|
|
|
129
129
|
size_bytes: number;
|
|
130
130
|
created_at: string;
|
|
131
131
|
}
|
|
132
|
+
/** One routable-and-priced model from `GET /v1/models`. Prices are USD per
|
|
133
|
+
* million tokens; `id` is the full `provider/model` spec, usable as-is when
|
|
134
|
+
* creating agents/sessions. The list is "what is known now" — see
|
|
135
|
+
* `TarsClient.models()` for the empty/partial cases. */
|
|
136
|
+
export interface ModelInfo {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
pricing: {
|
|
140
|
+
input: number;
|
|
141
|
+
output: number;
|
|
142
|
+
/** Absent ≠ free: TARS bills an unpublished cache-read price at the
|
|
143
|
+
* `input` rate (conservative upper bound). */
|
|
144
|
+
cache_read?: number;
|
|
145
|
+
/** Absent ≠ free: billed at the `input` rate when unpublished. Providers
|
|
146
|
+
* with genuinely free cache writes report an explicit 0. */
|
|
147
|
+
cache_write?: number;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
132
150
|
export interface ApiKeyInfo {
|
|
133
151
|
id: string;
|
|
134
152
|
key_prefix: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wice24/tars-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Client SDK for TARS — the self-hosted managed-agents platform (sessions, streaming turns, client tools, MCP credentials, skills, files, usage, tenant administration)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|