@soat/sdk 0.14.2 → 0.14.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/dist/index.cjs +113 -0
- package/dist/index.d.cts +597 -2
- package/dist/index.d.mts +597 -2
- package/dist/index.mjs +113 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -906,6 +906,34 @@ var AiProviders = class {
|
|
|
906
906
|
}
|
|
907
907
|
});
|
|
908
908
|
}
|
|
909
|
+
/**
|
|
910
|
+
* List per-provider price overrides
|
|
911
|
+
*
|
|
912
|
+
* Returns the per-provider price overrides for this AI provider instance. An override prices this specific provider (e.g. an enterprise-negotiated rate or a gateway with markup) and wins over the global default at cost time. Authorized by the caller's access to the provider's project — so, unlike the global price book, a project's own overrides are visible here.
|
|
913
|
+
*
|
|
914
|
+
*/
|
|
915
|
+
static getAiProviderPrices(options) {
|
|
916
|
+
return (options.client ?? client).get({
|
|
917
|
+
url: "/api/v1/ai-providers/{ai_provider_id}/prices",
|
|
918
|
+
...options
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Upsert per-provider price overrides
|
|
923
|
+
*
|
|
924
|
+
* Upserts price overrides for this AI provider instance, keyed on (model, effective_from). The provider slug is taken from the AI provider itself, so only the model, rates, and effective_from are supplied. Authorized by the caller's access to the provider's project. `effective_from` must be in the future — past prices are immutable, so ship corrections as new future-dated rows.
|
|
925
|
+
*
|
|
926
|
+
*/
|
|
927
|
+
static updateAiProviderPrices(options) {
|
|
928
|
+
return (options.client ?? client).put({
|
|
929
|
+
url: "/api/v1/ai-providers/{ai_provider_id}/prices",
|
|
930
|
+
...options,
|
|
931
|
+
headers: {
|
|
932
|
+
"Content-Type": "application/json",
|
|
933
|
+
...options.headers
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
}
|
|
909
937
|
};
|
|
910
938
|
var ApiKeys = class {
|
|
911
939
|
/**
|
|
@@ -2363,6 +2391,34 @@ var Projects = class {
|
|
|
2363
2391
|
}
|
|
2364
2392
|
});
|
|
2365
2393
|
}
|
|
2394
|
+
/**
|
|
2395
|
+
* List a project's price rows
|
|
2396
|
+
*
|
|
2397
|
+
* Returns the project's per-provider-slug price rows — the middle pricing tier that covers every one of the project's instances of a given provider slug. At cost time a per-provider-instance override wins over these, and these win over the global default. Authorized by the caller's access to the project.
|
|
2398
|
+
*
|
|
2399
|
+
*/
|
|
2400
|
+
static getProjectPrices(options) {
|
|
2401
|
+
return (options.client ?? client).get({
|
|
2402
|
+
url: "/api/v1/projects/{project_id}/prices",
|
|
2403
|
+
...options
|
|
2404
|
+
});
|
|
2405
|
+
}
|
|
2406
|
+
/**
|
|
2407
|
+
* Upsert a project's price rows
|
|
2408
|
+
*
|
|
2409
|
+
* Upserts project + provider-slug price rows, keyed on (provider, model, effective_from). A row covers all of the project's instances of that provider slug. Authorized by the caller's access to the project. `effective_from` must be in the future — past prices are immutable, so ship corrections as new future-dated rows.
|
|
2410
|
+
*
|
|
2411
|
+
*/
|
|
2412
|
+
static updateProjectPrices(options) {
|
|
2413
|
+
return (options.client ?? client).put({
|
|
2414
|
+
url: "/api/v1/projects/{project_id}/prices",
|
|
2415
|
+
...options,
|
|
2416
|
+
headers: {
|
|
2417
|
+
"Content-Type": "application/json",
|
|
2418
|
+
...options.headers
|
|
2419
|
+
}
|
|
2420
|
+
});
|
|
2421
|
+
}
|
|
2366
2422
|
};
|
|
2367
2423
|
var Secrets = class {
|
|
2368
2424
|
/**
|
|
@@ -2828,6 +2884,60 @@ var Triggers = class {
|
|
|
2828
2884
|
});
|
|
2829
2885
|
}
|
|
2830
2886
|
};
|
|
2887
|
+
var Usage = class {
|
|
2888
|
+
/**
|
|
2889
|
+
* List usage meters
|
|
2890
|
+
*
|
|
2891
|
+
* Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent and generation. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.
|
|
2892
|
+
*
|
|
2893
|
+
*/
|
|
2894
|
+
static listUsageMeters(options) {
|
|
2895
|
+
return (options?.client ?? client).get({
|
|
2896
|
+
url: "/api/v1/usage/meters",
|
|
2897
|
+
...options
|
|
2898
|
+
});
|
|
2899
|
+
}
|
|
2900
|
+
/**
|
|
2901
|
+
* Get a generation's billing receipt
|
|
2902
|
+
*
|
|
2903
|
+
* Returns a billing receipt for a completed generation: per-model line items (tokens, the price-book version that priced them, and cost) plus totals.
|
|
2904
|
+
*
|
|
2905
|
+
*/
|
|
2906
|
+
static getUsageReceipt(options) {
|
|
2907
|
+
return (options.client ?? client).get({
|
|
2908
|
+
url: "/api/v1/usage/receipt",
|
|
2909
|
+
...options
|
|
2910
|
+
});
|
|
2911
|
+
}
|
|
2912
|
+
/**
|
|
2913
|
+
* Get the price book
|
|
2914
|
+
*
|
|
2915
|
+
* Returns the global price book — the versioned per-provider/model unit prices used to compute usage cost at write time. Readable by any authenticated user.
|
|
2916
|
+
*
|
|
2917
|
+
*/
|
|
2918
|
+
static getPriceBook(options) {
|
|
2919
|
+
return (options?.client ?? client).get({
|
|
2920
|
+
url: "/api/v1/usage/prices",
|
|
2921
|
+
...options
|
|
2922
|
+
});
|
|
2923
|
+
}
|
|
2924
|
+
/**
|
|
2925
|
+
* Upsert price-book rows
|
|
2926
|
+
*
|
|
2927
|
+
* Upserts price rows keyed on (provider, model, effective_from). Admin only. `effective_from` must be in the future — past prices are immutable so recorded costs stay explainable; ship corrections as new future-dated rows.
|
|
2928
|
+
*
|
|
2929
|
+
*/
|
|
2930
|
+
static upsertPriceBook(options) {
|
|
2931
|
+
return (options.client ?? client).put({
|
|
2932
|
+
url: "/api/v1/usage/prices",
|
|
2933
|
+
...options,
|
|
2934
|
+
headers: {
|
|
2935
|
+
"Content-Type": "application/json",
|
|
2936
|
+
...options.headers
|
|
2937
|
+
}
|
|
2938
|
+
});
|
|
2939
|
+
}
|
|
2940
|
+
};
|
|
2831
2941
|
var Users = class {
|
|
2832
2942
|
/**
|
|
2833
2943
|
* Get the current authenticated user
|
|
@@ -3107,6 +3217,7 @@ var SoatClient = class {
|
|
|
3107
3217
|
tools;
|
|
3108
3218
|
traces;
|
|
3109
3219
|
triggers;
|
|
3220
|
+
usage;
|
|
3110
3221
|
users;
|
|
3111
3222
|
webhooks;
|
|
3112
3223
|
constructor({ baseUrl, token, headers } = {}) {
|
|
@@ -3138,6 +3249,7 @@ var SoatClient = class {
|
|
|
3138
3249
|
this.tools = bindResource(Tools, httpClient);
|
|
3139
3250
|
this.traces = bindResource(Traces, httpClient);
|
|
3140
3251
|
this.triggers = bindResource(Triggers, httpClient);
|
|
3252
|
+
this.usage = bindResource(Usage, httpClient);
|
|
3141
3253
|
this.users = bindResource(Users, httpClient);
|
|
3142
3254
|
this.webhooks = bindResource(Webhooks, httpClient);
|
|
3143
3255
|
}
|
|
@@ -3168,6 +3280,7 @@ exports.SoatClient = SoatClient;
|
|
|
3168
3280
|
exports.Tools = Tools;
|
|
3169
3281
|
exports.Traces = Traces;
|
|
3170
3282
|
exports.Triggers = Triggers;
|
|
3283
|
+
exports.Usage = Usage;
|
|
3171
3284
|
exports.Users = Users;
|
|
3172
3285
|
exports.Webhooks = Webhooks;
|
|
3173
3286
|
exports.createClient = createClient;
|