cencori 1.7.5 → 1.8.1
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/README.md +1 -1
- package/dist/ai/index.d.mts +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.js +154 -19
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/index.mjs +152 -19
- package/dist/ai/index.mjs.map +1 -1
- package/dist/catalog/index.d.mts +113 -0
- package/dist/catalog/index.d.ts +113 -0
- package/dist/catalog/index.js +73 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/catalog/index.mjs +45 -0
- package/dist/catalog/index.mjs.map +1 -0
- package/dist/compute/index.d.mts +1 -1
- package/dist/compute/index.d.ts +1 -1
- package/dist/documents/index.d.mts +1 -1
- package/dist/documents/index.d.ts +1 -1
- package/dist/index.d.mts +106 -12
- package/dist/index.d.ts +106 -12
- package/dist/index.js +324 -101
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +319 -100
- package/dist/index.mjs.map +1 -1
- package/dist/memory/index.d.mts +151 -26
- package/dist/memory/index.d.ts +151 -26
- package/dist/memory/index.js +210 -6
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/index.mjs +208 -6
- package/dist/memory/index.mjs.map +1 -1
- package/dist/storage/index.d.mts +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/telemetry/index.d.mts +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/{types-CZSIg4JQ.d.mts → types-DbHh0iAg.d.mts} +30 -1
- package/dist/{types-CZSIg4JQ.d.ts → types-DbHh0iAg.d.ts} +30 -1
- package/dist/vision/index.d.mts +1 -1
- package/dist/vision/index.d.ts +1 -1
- package/dist/voice/index.d.mts +1 -1
- package/dist/voice/index.d.ts +1 -1
- package/dist/web/index.d.mts +1 -1
- package/dist/web/index.d.ts +1 -1
- package/dist/workflow/index.d.mts +1 -1
- package/dist/workflow/index.d.ts +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public catalog — models and providers.
|
|
3
|
+
*
|
|
4
|
+
* Keyless helpers over the public endpoints (`GET /api/models`,
|
|
5
|
+
* `GET /api/providers`, `GET /api/providers/:id/logo`). No `Cencori` client
|
|
6
|
+
* or API key needed, so these are safe to call from a browser bundle when
|
|
7
|
+
* embedding Cencori's model/provider shelf (with logos) inside your product.
|
|
8
|
+
*
|
|
9
|
+
* This is the *marketing* catalog: static display pricing, no per-project
|
|
10
|
+
* availability. Authenticated callers needing per-key availability, DB-backed
|
|
11
|
+
* pricing and BYOK/custom rows should use `cencori.models.list()` instead.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { listCatalogModels, listCatalogProviders, providerLogoUrl } from 'cencori';
|
|
16
|
+
*
|
|
17
|
+
* const { data: models } = await listCatalogModels({ provider: 'openai' });
|
|
18
|
+
* const { data: providers } = await listCatalogProviders();
|
|
19
|
+
* const logo = providerLogoUrl('openai'); // https://cencori.com/api/providers/openai/logo
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare const DEFAULT_CATALOG_BASE_URL = "https://cencori.com";
|
|
23
|
+
interface CatalogModelPricing {
|
|
24
|
+
input_per_million: number | null;
|
|
25
|
+
output_per_million: number | null;
|
|
26
|
+
currency: 'USD';
|
|
27
|
+
input_display: string;
|
|
28
|
+
output_display: string;
|
|
29
|
+
per_image: boolean;
|
|
30
|
+
per_image_usd: number | null;
|
|
31
|
+
}
|
|
32
|
+
interface CatalogModel {
|
|
33
|
+
id: string;
|
|
34
|
+
object: 'model';
|
|
35
|
+
name: string;
|
|
36
|
+
provider: string;
|
|
37
|
+
provider_name: string;
|
|
38
|
+
/** Absolute logo URL — safe to use as an <img> src directly. */
|
|
39
|
+
provider_logo_url: string;
|
|
40
|
+
owned_by: string;
|
|
41
|
+
type: string;
|
|
42
|
+
types: string[];
|
|
43
|
+
context_window: number;
|
|
44
|
+
context_display: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
capabilities?: Record<string, boolean>;
|
|
47
|
+
pricing: CatalogModelPricing;
|
|
48
|
+
added_at: string | null;
|
|
49
|
+
created: number;
|
|
50
|
+
}
|
|
51
|
+
interface CatalogProvider {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
/** Relative static icon path (may not exist for every vendor). */
|
|
55
|
+
icon: string;
|
|
56
|
+
/** Absolute icon URL. Falls back to `logo_url` when no static file exists. */
|
|
57
|
+
icon_url: string;
|
|
58
|
+
/** Absolute logo URL — always returns an SVG. Prefer this for embedding. */
|
|
59
|
+
logo_url: string;
|
|
60
|
+
website: string;
|
|
61
|
+
docs_url: string;
|
|
62
|
+
model_count: number;
|
|
63
|
+
}
|
|
64
|
+
interface CatalogModelsResponse {
|
|
65
|
+
object: 'list';
|
|
66
|
+
data: CatalogModel[];
|
|
67
|
+
providers: CatalogProvider[];
|
|
68
|
+
total: number;
|
|
69
|
+
distinct_model_ids: number;
|
|
70
|
+
updated_at: string;
|
|
71
|
+
}
|
|
72
|
+
interface CatalogProvidersResponse {
|
|
73
|
+
object: 'list';
|
|
74
|
+
data: CatalogProvider[];
|
|
75
|
+
total: number;
|
|
76
|
+
updated_at: string;
|
|
77
|
+
}
|
|
78
|
+
interface CatalogModelFilters {
|
|
79
|
+
/** Provider id, e.g. 'openai' (case-insensitive). */
|
|
80
|
+
provider?: string;
|
|
81
|
+
/** Model type: chat, reasoning, code, search, vision, image. */
|
|
82
|
+
type?: string;
|
|
83
|
+
/** Substring match on name, id, provider, description. */
|
|
84
|
+
search?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Capability filter — a model must carry every one listed:
|
|
87
|
+
* reasoning, vision, code, search, image, tools, structuredOutput,
|
|
88
|
+
* fileInput, videoInput, audioInput, caching.
|
|
89
|
+
*/
|
|
90
|
+
capability?: string | string[];
|
|
91
|
+
}
|
|
92
|
+
interface CatalogRequestOptions {
|
|
93
|
+
/** Catalog host (default: https://cencori.com). */
|
|
94
|
+
baseUrl?: string;
|
|
95
|
+
signal?: AbortSignal;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* List the public model catalog — the same data rendered on
|
|
99
|
+
* https://cencori.com/ai-gateway/models. No API key required.
|
|
100
|
+
*/
|
|
101
|
+
declare function listCatalogModels(filters?: CatalogModelFilters, options?: CatalogRequestOptions): Promise<CatalogModelsResponse>;
|
|
102
|
+
/** List providers with logo URLs and model counts. No API key required. */
|
|
103
|
+
declare function listCatalogProviders(options?: CatalogRequestOptions): Promise<CatalogProvidersResponse>;
|
|
104
|
+
/**
|
|
105
|
+
* Absolute URL of a provider's logo (SVG). Always resolves for known
|
|
106
|
+
* providers — serve it straight into an `<img>` tag. No fetch needed.
|
|
107
|
+
*
|
|
108
|
+
* NOTE: several brand marks are white (OpenAI, Anthropic) — render them on
|
|
109
|
+
* a dark chip.
|
|
110
|
+
*/
|
|
111
|
+
declare function providerLogoUrl(providerId: string, baseUrl?: string): string;
|
|
112
|
+
|
|
113
|
+
export { type CatalogModel, type CatalogModelFilters, type CatalogModelPricing, type CatalogModelsResponse, type CatalogProvider, type CatalogProvidersResponse, type CatalogRequestOptions, DEFAULT_CATALOG_BASE_URL, listCatalogModels, listCatalogProviders, providerLogoUrl };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/catalog/index.ts
|
|
21
|
+
var catalog_exports = {};
|
|
22
|
+
__export(catalog_exports, {
|
|
23
|
+
DEFAULT_CATALOG_BASE_URL: () => DEFAULT_CATALOG_BASE_URL,
|
|
24
|
+
listCatalogModels: () => listCatalogModels,
|
|
25
|
+
listCatalogProviders: () => listCatalogProviders,
|
|
26
|
+
providerLogoUrl: () => providerLogoUrl
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(catalog_exports);
|
|
29
|
+
var DEFAULT_CATALOG_BASE_URL = "https://cencori.com";
|
|
30
|
+
function baseUrlOf(options) {
|
|
31
|
+
return (options?.baseUrl ?? DEFAULT_CATALOG_BASE_URL).replace(/\/$/, "");
|
|
32
|
+
}
|
|
33
|
+
function modelQuery(filters) {
|
|
34
|
+
const search = new URLSearchParams();
|
|
35
|
+
if (filters?.provider) search.set("provider", filters.provider);
|
|
36
|
+
if (filters?.type) search.set("type", filters.type);
|
|
37
|
+
if (filters?.search) search.set("search", filters.search);
|
|
38
|
+
const caps = filters?.capability ? Array.isArray(filters.capability) ? filters.capability : [filters.capability] : [];
|
|
39
|
+
for (const cap of caps) search.append("capability", cap);
|
|
40
|
+
const s = search.toString();
|
|
41
|
+
return s ? `?${s}` : "";
|
|
42
|
+
}
|
|
43
|
+
async function getJson(url, signal) {
|
|
44
|
+
const response = await fetch(url, { signal });
|
|
45
|
+
if (!response.ok) {
|
|
46
|
+
const body = await response.text().catch(() => "");
|
|
47
|
+
throw new Error(`Catalog request failed (${response.status} ${url})${body ? `: ${body.slice(0, 200)}` : ""}`);
|
|
48
|
+
}
|
|
49
|
+
return response.json();
|
|
50
|
+
}
|
|
51
|
+
function listCatalogModels(filters, options) {
|
|
52
|
+
return getJson(
|
|
53
|
+
`${baseUrlOf(options)}/api/models${modelQuery(filters)}`,
|
|
54
|
+
options?.signal
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function listCatalogProviders(options) {
|
|
58
|
+
return getJson(
|
|
59
|
+
`${baseUrlOf(options)}/api/providers`,
|
|
60
|
+
options?.signal
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
function providerLogoUrl(providerId, baseUrl = DEFAULT_CATALOG_BASE_URL) {
|
|
64
|
+
return `${baseUrl.replace(/\/$/, "")}/api/providers/${encodeURIComponent(providerId)}/logo`;
|
|
65
|
+
}
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
DEFAULT_CATALOG_BASE_URL,
|
|
69
|
+
listCatalogModels,
|
|
70
|
+
listCatalogProviders,
|
|
71
|
+
providerLogoUrl
|
|
72
|
+
});
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/catalog/index.ts"],"sourcesContent":["/**\n * Public catalog — models and providers.\n *\n * Keyless helpers over the public endpoints (`GET /api/models`,\n * `GET /api/providers`, `GET /api/providers/:id/logo`). No `Cencori` client\n * or API key needed, so these are safe to call from a browser bundle when\n * embedding Cencori's model/provider shelf (with logos) inside your product.\n *\n * This is the *marketing* catalog: static display pricing, no per-project\n * availability. Authenticated callers needing per-key availability, DB-backed\n * pricing and BYOK/custom rows should use `cencori.models.list()` instead.\n *\n * @example\n * ```typescript\n * import { listCatalogModels, listCatalogProviders, providerLogoUrl } from 'cencori';\n *\n * const { data: models } = await listCatalogModels({ provider: 'openai' });\n * const { data: providers } = await listCatalogProviders();\n * const logo = providerLogoUrl('openai'); // https://cencori.com/api/providers/openai/logo\n * ```\n */\n\nexport const DEFAULT_CATALOG_BASE_URL = 'https://cencori.com';\n\nexport interface CatalogModelPricing {\n input_per_million: number | null;\n output_per_million: number | null;\n currency: 'USD';\n input_display: string;\n output_display: string;\n per_image: boolean;\n per_image_usd: number | null;\n}\n\nexport interface CatalogModel {\n id: string;\n object: 'model';\n name: string;\n provider: string;\n provider_name: string;\n /** Absolute logo URL — safe to use as an <img> src directly. */\n provider_logo_url: string;\n owned_by: string;\n type: string;\n types: string[];\n context_window: number;\n context_display: string;\n description?: string;\n capabilities?: Record<string, boolean>;\n pricing: CatalogModelPricing;\n added_at: string | null;\n created: number;\n}\n\nexport interface CatalogProvider {\n id: string;\n name: string;\n /** Relative static icon path (may not exist for every vendor). */\n icon: string;\n /** Absolute icon URL. Falls back to `logo_url` when no static file exists. */\n icon_url: string;\n /** Absolute logo URL — always returns an SVG. Prefer this for embedding. */\n logo_url: string;\n website: string;\n docs_url: string;\n model_count: number;\n}\n\nexport interface CatalogModelsResponse {\n object: 'list';\n data: CatalogModel[];\n providers: CatalogProvider[];\n total: number;\n distinct_model_ids: number;\n updated_at: string;\n}\n\nexport interface CatalogProvidersResponse {\n object: 'list';\n data: CatalogProvider[];\n total: number;\n updated_at: string;\n}\n\nexport interface CatalogModelFilters {\n /** Provider id, e.g. 'openai' (case-insensitive). */\n provider?: string;\n /** Model type: chat, reasoning, code, search, vision, image. */\n type?: string;\n /** Substring match on name, id, provider, description. */\n search?: string;\n /**\n * Capability filter — a model must carry every one listed:\n * reasoning, vision, code, search, image, tools, structuredOutput,\n * fileInput, videoInput, audioInput, caching.\n */\n capability?: string | string[];\n}\n\nexport interface CatalogRequestOptions {\n /** Catalog host (default: https://cencori.com). */\n baseUrl?: string;\n signal?: AbortSignal;\n}\n\nfunction baseUrlOf(options?: CatalogRequestOptions): string {\n return (options?.baseUrl ?? DEFAULT_CATALOG_BASE_URL).replace(/\\/$/, '');\n}\n\nfunction modelQuery(filters?: CatalogModelFilters): string {\n const search = new URLSearchParams();\n if (filters?.provider) search.set('provider', filters.provider);\n if (filters?.type) search.set('type', filters.type);\n if (filters?.search) search.set('search', filters.search);\n const caps = filters?.capability\n ? (Array.isArray(filters.capability) ? filters.capability : [filters.capability])\n : [];\n for (const cap of caps) search.append('capability', cap);\n const s = search.toString();\n return s ? `?${s}` : '';\n}\n\nasync function getJson<T>(url: string, signal?: AbortSignal): Promise<T> {\n const response = await fetch(url, { signal });\n if (!response.ok) {\n const body = await response.text().catch(() => '');\n throw new Error(`Catalog request failed (${response.status} ${url})${body ? `: ${body.slice(0, 200)}` : ''}`);\n }\n return response.json() as Promise<T>;\n}\n\n/**\n * List the public model catalog — the same data rendered on\n * https://cencori.com/ai-gateway/models. No API key required.\n */\nexport function listCatalogModels(\n filters?: CatalogModelFilters,\n options?: CatalogRequestOptions,\n): Promise<CatalogModelsResponse> {\n return getJson<CatalogModelsResponse>(\n `${baseUrlOf(options)}/api/models${modelQuery(filters)}`,\n options?.signal,\n );\n}\n\n/** List providers with logo URLs and model counts. No API key required. */\nexport function listCatalogProviders(\n options?: CatalogRequestOptions,\n): Promise<CatalogProvidersResponse> {\n return getJson<CatalogProvidersResponse>(\n `${baseUrlOf(options)}/api/providers`,\n options?.signal,\n );\n}\n\n/**\n * Absolute URL of a provider's logo (SVG). Always resolves for known\n * providers — serve it straight into an `<img>` tag. No fetch needed.\n *\n * NOTE: several brand marks are white (OpenAI, Anthropic) — render them on\n * a dark chip.\n */\nexport function providerLogoUrl(providerId: string, baseUrl: string = DEFAULT_CATALOG_BASE_URL): string {\n return `${baseUrl.replace(/\\/$/, '')}/api/providers/${encodeURIComponent(providerId)}/logo`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBO,IAAM,2BAA2B;AAmFxC,SAAS,UAAU,SAAyC;AACxD,UAAQ,SAAS,WAAW,0BAA0B,QAAQ,OAAO,EAAE;AAC3E;AAEA,SAAS,WAAW,SAAuC;AACvD,QAAM,SAAS,IAAI,gBAAgB;AACnC,MAAI,SAAS,SAAU,QAAO,IAAI,YAAY,QAAQ,QAAQ;AAC9D,MAAI,SAAS,KAAM,QAAO,IAAI,QAAQ,QAAQ,IAAI;AAClD,MAAI,SAAS,OAAQ,QAAO,IAAI,UAAU,QAAQ,MAAM;AACxD,QAAM,OAAO,SAAS,aACf,MAAM,QAAQ,QAAQ,UAAU,IAAI,QAAQ,aAAa,CAAC,QAAQ,UAAU,IAC7E,CAAC;AACP,aAAW,OAAO,KAAM,QAAO,OAAO,cAAc,GAAG;AACvD,QAAM,IAAI,OAAO,SAAS;AAC1B,SAAO,IAAI,IAAI,CAAC,KAAK;AACzB;AAEA,eAAe,QAAW,KAAa,QAAkC;AACrE,QAAM,WAAW,MAAM,MAAM,KAAK,EAAE,OAAO,CAAC;AAC5C,MAAI,CAAC,SAAS,IAAI;AACd,UAAM,OAAO,MAAM,SAAS,KAAK,EAAE,MAAM,MAAM,EAAE;AACjD,UAAM,IAAI,MAAM,2BAA2B,SAAS,MAAM,IAAI,GAAG,IAAI,OAAO,KAAK,KAAK,MAAM,GAAG,GAAG,CAAC,KAAK,EAAE,EAAE;AAAA,EAChH;AACA,SAAO,SAAS,KAAK;AACzB;AAMO,SAAS,kBACZ,SACA,SAC8B;AAC9B,SAAO;AAAA,IACH,GAAG,UAAU,OAAO,CAAC,cAAc,WAAW,OAAO,CAAC;AAAA,IACtD,SAAS;AAAA,EACb;AACJ;AAGO,SAAS,qBACZ,SACiC;AACjC,SAAO;AAAA,IACH,GAAG,UAAU,OAAO,CAAC;AAAA,IACrB,SAAS;AAAA,EACb;AACJ;AASO,SAAS,gBAAgB,YAAoB,UAAkB,0BAAkC;AACpG,SAAO,GAAG,QAAQ,QAAQ,OAAO,EAAE,CAAC,kBAAkB,mBAAmB,UAAU,CAAC;AACxF;","names":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/catalog/index.ts
|
|
2
|
+
var DEFAULT_CATALOG_BASE_URL = "https://cencori.com";
|
|
3
|
+
function baseUrlOf(options) {
|
|
4
|
+
return (options?.baseUrl ?? DEFAULT_CATALOG_BASE_URL).replace(/\/$/, "");
|
|
5
|
+
}
|
|
6
|
+
function modelQuery(filters) {
|
|
7
|
+
const search = new URLSearchParams();
|
|
8
|
+
if (filters?.provider) search.set("provider", filters.provider);
|
|
9
|
+
if (filters?.type) search.set("type", filters.type);
|
|
10
|
+
if (filters?.search) search.set("search", filters.search);
|
|
11
|
+
const caps = filters?.capability ? Array.isArray(filters.capability) ? filters.capability : [filters.capability] : [];
|
|
12
|
+
for (const cap of caps) search.append("capability", cap);
|
|
13
|
+
const s = search.toString();
|
|
14
|
+
return s ? `?${s}` : "";
|
|
15
|
+
}
|
|
16
|
+
async function getJson(url, signal) {
|
|
17
|
+
const response = await fetch(url, { signal });
|
|
18
|
+
if (!response.ok) {
|
|
19
|
+
const body = await response.text().catch(() => "");
|
|
20
|
+
throw new Error(`Catalog request failed (${response.status} ${url})${body ? `: ${body.slice(0, 200)}` : ""}`);
|
|
21
|
+
}
|
|
22
|
+
return response.json();
|
|
23
|
+
}
|
|
24
|
+
function listCatalogModels(filters, options) {
|
|
25
|
+
return getJson(
|
|
26
|
+
`${baseUrlOf(options)}/api/models${modelQuery(filters)}`,
|
|
27
|
+
options?.signal
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function listCatalogProviders(options) {
|
|
31
|
+
return getJson(
|
|
32
|
+
`${baseUrlOf(options)}/api/providers`,
|
|
33
|
+
options?.signal
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
function providerLogoUrl(providerId, baseUrl = DEFAULT_CATALOG_BASE_URL) {
|
|
37
|
+
return `${baseUrl.replace(/\/$/, "")}/api/providers/${encodeURIComponent(providerId)}/logo`;
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
DEFAULT_CATALOG_BASE_URL,
|
|
41
|
+
listCatalogModels,
|
|
42
|
+
listCatalogProviders,
|
|
43
|
+
providerLogoUrl
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/catalog/index.ts"],"sourcesContent":["/**\n * Public catalog — models and providers.\n *\n * Keyless helpers over the public endpoints (`GET /api/models`,\n * `GET /api/providers`, `GET /api/providers/:id/logo`). No `Cencori` client\n * or API key needed, so these are safe to call from a browser bundle when\n * embedding Cencori's model/provider shelf (with logos) inside your product.\n *\n * This is the *marketing* catalog: static display pricing, no per-project\n * availability. Authenticated callers needing per-key availability, DB-backed\n * pricing and BYOK/custom rows should use `cencori.models.list()` instead.\n *\n * @example\n * ```typescript\n * import { listCatalogModels, listCatalogProviders, providerLogoUrl } from 'cencori';\n *\n * const { data: models } = await listCatalogModels({ provider: 'openai' });\n * const { data: providers } = await listCatalogProviders();\n * const logo = providerLogoUrl('openai'); // https://cencori.com/api/providers/openai/logo\n * ```\n */\n\nexport const DEFAULT_CATALOG_BASE_URL = 'https://cencori.com';\n\nexport interface CatalogModelPricing {\n input_per_million: number | null;\n output_per_million: number | null;\n currency: 'USD';\n input_display: string;\n output_display: string;\n per_image: boolean;\n per_image_usd: number | null;\n}\n\nexport interface CatalogModel {\n id: string;\n object: 'model';\n name: string;\n provider: string;\n provider_name: string;\n /** Absolute logo URL — safe to use as an <img> src directly. */\n provider_logo_url: string;\n owned_by: string;\n type: string;\n types: string[];\n context_window: number;\n context_display: string;\n description?: string;\n capabilities?: Record<string, boolean>;\n pricing: CatalogModelPricing;\n added_at: string | null;\n created: number;\n}\n\nexport interface CatalogProvider {\n id: string;\n name: string;\n /** Relative static icon path (may not exist for every vendor). */\n icon: string;\n /** Absolute icon URL. Falls back to `logo_url` when no static file exists. */\n icon_url: string;\n /** Absolute logo URL — always returns an SVG. Prefer this for embedding. */\n logo_url: string;\n website: string;\n docs_url: string;\n model_count: number;\n}\n\nexport interface CatalogModelsResponse {\n object: 'list';\n data: CatalogModel[];\n providers: CatalogProvider[];\n total: number;\n distinct_model_ids: number;\n updated_at: string;\n}\n\nexport interface CatalogProvidersResponse {\n object: 'list';\n data: CatalogProvider[];\n total: number;\n updated_at: string;\n}\n\nexport interface CatalogModelFilters {\n /** Provider id, e.g. 'openai' (case-insensitive). */\n provider?: string;\n /** Model type: chat, reasoning, code, search, vision, image. */\n type?: string;\n /** Substring match on name, id, provider, description. */\n search?: string;\n /**\n * Capability filter — a model must carry every one listed:\n * reasoning, vision, code, search, image, tools, structuredOutput,\n * fileInput, videoInput, audioInput, caching.\n */\n capability?: string | string[];\n}\n\nexport interface CatalogRequestOptions {\n /** Catalog host (default: https://cencori.com). */\n baseUrl?: string;\n signal?: AbortSignal;\n}\n\nfunction baseUrlOf(options?: CatalogRequestOptions): string {\n return (options?.baseUrl ?? DEFAULT_CATALOG_BASE_URL).replace(/\\/$/, '');\n}\n\nfunction modelQuery(filters?: CatalogModelFilters): string {\n const search = new URLSearchParams();\n if (filters?.provider) search.set('provider', filters.provider);\n if (filters?.type) search.set('type', filters.type);\n if (filters?.search) search.set('search', filters.search);\n const caps = filters?.capability\n ? (Array.isArray(filters.capability) ? filters.capability : [filters.capability])\n : [];\n for (const cap of caps) search.append('capability', cap);\n const s = search.toString();\n return s ? `?${s}` : '';\n}\n\nasync function getJson<T>(url: string, signal?: AbortSignal): Promise<T> {\n const response = await fetch(url, { signal });\n if (!response.ok) {\n const body = await response.text().catch(() => '');\n throw new Error(`Catalog request failed (${response.status} ${url})${body ? `: ${body.slice(0, 200)}` : ''}`);\n }\n return response.json() as Promise<T>;\n}\n\n/**\n * List the public model catalog — the same data rendered on\n * https://cencori.com/ai-gateway/models. No API key required.\n */\nexport function listCatalogModels(\n filters?: CatalogModelFilters,\n options?: CatalogRequestOptions,\n): Promise<CatalogModelsResponse> {\n return getJson<CatalogModelsResponse>(\n `${baseUrlOf(options)}/api/models${modelQuery(filters)}`,\n options?.signal,\n );\n}\n\n/** List providers with logo URLs and model counts. No API key required. */\nexport function listCatalogProviders(\n options?: CatalogRequestOptions,\n): Promise<CatalogProvidersResponse> {\n return getJson<CatalogProvidersResponse>(\n `${baseUrlOf(options)}/api/providers`,\n options?.signal,\n );\n}\n\n/**\n * Absolute URL of a provider's logo (SVG). Always resolves for known\n * providers — serve it straight into an `<img>` tag. No fetch needed.\n *\n * NOTE: several brand marks are white (OpenAI, Anthropic) — render them on\n * a dark chip.\n */\nexport function providerLogoUrl(providerId: string, baseUrl: string = DEFAULT_CATALOG_BASE_URL): string {\n return `${baseUrl.replace(/\\/$/, '')}/api/providers/${encodeURIComponent(providerId)}/logo`;\n}\n"],"mappings":";AAsBO,IAAM,2BAA2B;AAmFxC,SAAS,UAAU,SAAyC;AACxD,UAAQ,SAAS,WAAW,0BAA0B,QAAQ,OAAO,EAAE;AAC3E;AAEA,SAAS,WAAW,SAAuC;AACvD,QAAM,SAAS,IAAI,gBAAgB;AACnC,MAAI,SAAS,SAAU,QAAO,IAAI,YAAY,QAAQ,QAAQ;AAC9D,MAAI,SAAS,KAAM,QAAO,IAAI,QAAQ,QAAQ,IAAI;AAClD,MAAI,SAAS,OAAQ,QAAO,IAAI,UAAU,QAAQ,MAAM;AACxD,QAAM,OAAO,SAAS,aACf,MAAM,QAAQ,QAAQ,UAAU,IAAI,QAAQ,aAAa,CAAC,QAAQ,UAAU,IAC7E,CAAC;AACP,aAAW,OAAO,KAAM,QAAO,OAAO,cAAc,GAAG;AACvD,QAAM,IAAI,OAAO,SAAS;AAC1B,SAAO,IAAI,IAAI,CAAC,KAAK;AACzB;AAEA,eAAe,QAAW,KAAa,QAAkC;AACrE,QAAM,WAAW,MAAM,MAAM,KAAK,EAAE,OAAO,CAAC;AAC5C,MAAI,CAAC,SAAS,IAAI;AACd,UAAM,OAAO,MAAM,SAAS,KAAK,EAAE,MAAM,MAAM,EAAE;AACjD,UAAM,IAAI,MAAM,2BAA2B,SAAS,MAAM,IAAI,GAAG,IAAI,OAAO,KAAK,KAAK,MAAM,GAAG,GAAG,CAAC,KAAK,EAAE,EAAE;AAAA,EAChH;AACA,SAAO,SAAS,KAAK;AACzB;AAMO,SAAS,kBACZ,SACA,SAC8B;AAC9B,SAAO;AAAA,IACH,GAAG,UAAU,OAAO,CAAC,cAAc,WAAW,OAAO,CAAC;AAAA,IACtD,SAAS;AAAA,EACb;AACJ;AAGO,SAAS,qBACZ,SACiC;AACjC,SAAO;AAAA,IACH,GAAG,UAAU,OAAO,CAAC;AAAA,IACrB,SAAS;AAAA,EACb;AACJ;AASO,SAAS,gBAAgB,YAAoB,UAAkB,0BAAkC;AACpG,SAAO,GAAG,QAAQ,QAAQ,OAAO,EAAE,CAAC,kBAAkB,mBAAmB,UAAU,CAAC;AACxF;","names":[]}
|
package/dist/compute/index.d.mts
CHANGED
package/dist/compute/index.d.ts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CencoriConfig, i as RequestOptions } from './types-
|
|
2
|
-
export { j as ChatMessage, a as ChatRequest, b as ChatResponse, o as CodeInterpreterTool, c as CompletionRequest, E as EmbeddingRequest, d as EmbeddingResponse, F as FileSearchTool, l as ResponseInputItem, k as ResponsesOutputItem, R as ResponsesRequest, g as ResponsesResponse, m as ResponsesTool, U as UrlCitation, n as WebSearchTool } from './types-
|
|
1
|
+
import { C as CencoriConfig, i as RequestOptions } from './types-DbHh0iAg.mjs';
|
|
2
|
+
export { j as ChatMessage, a as ChatRequest, b as ChatResponse, o as CodeInterpreterTool, c as CompletionRequest, E as EmbeddingRequest, d as EmbeddingResponse, F as FileSearchTool, l as ResponseInputItem, k as ResponsesOutputItem, R as ResponsesRequest, g as ResponsesResponse, m as ResponsesTool, U as UrlCitation, n as WebSearchTool } from './types-DbHh0iAg.mjs';
|
|
3
3
|
import { AINamespace } from './ai/index.mjs';
|
|
4
4
|
export { StreamChunk } from './ai/index.mjs';
|
|
5
5
|
import { VisionNamespace } from './vision/index.mjs';
|
|
@@ -17,6 +17,7 @@ import { TelemetryClient } from './telemetry/index.mjs';
|
|
|
17
17
|
export { WebTelemetryPayload } from './telemetry/index.mjs';
|
|
18
18
|
import { WebNamespace } from './web/index.mjs';
|
|
19
19
|
export { WEB_FETCH_TOOL, WEB_SEARCH_TOOL, WebBrowseJob, WebBrowseRequest, WebBrowserAction, WebCrawlRequest, WebCrawlResponse, WebEvidenceSpan, WebExtractResult, WebFetchRequest, WebFetchResult, WebLink, WebSearchHit, WebSearchRequest, WebSearchResponse, WebTakedownRequest, WebTakedownResponse } from './web/index.mjs';
|
|
20
|
+
export { CatalogModel, CatalogModelFilters, CatalogModelPricing, CatalogModelsResponse, CatalogProvider, CatalogProvidersResponse, CatalogRequestOptions, DEFAULT_CATALOG_BASE_URL, listCatalogModels, listCatalogProviders, providerLogoUrl } from './catalog/index.mjs';
|
|
20
21
|
export { CencoriChatSettings, CencoriProvider, CencoriProviderSettings, cencori, createCencori } from './vercel/index.mjs';
|
|
21
22
|
import '@ai-sdk/provider';
|
|
22
23
|
|
|
@@ -286,6 +287,20 @@ interface ChatCompletionResponse {
|
|
|
286
287
|
content: string;
|
|
287
288
|
}>;
|
|
288
289
|
write_status: 'pending' | 'disabled';
|
|
290
|
+
/** Chat request id backing the async writeback — poll GET /v1/memory/writes/:id. Null when write is disabled. */
|
|
291
|
+
write_request_id?: string | null;
|
|
292
|
+
};
|
|
293
|
+
/** Request id for support correlation (X-Request-Id). */
|
|
294
|
+
requestId?: string | null;
|
|
295
|
+
/** Input-guard classification the gateway verdicts (absent when unstreamed/skipped). */
|
|
296
|
+
safety?: {
|
|
297
|
+
scanned: boolean;
|
|
298
|
+
input?: {
|
|
299
|
+
safe: boolean;
|
|
300
|
+
layer: string;
|
|
301
|
+
riskScore: number;
|
|
302
|
+
reasons: string[];
|
|
303
|
+
};
|
|
289
304
|
};
|
|
290
305
|
}
|
|
291
306
|
interface ChatCompletionChunk {
|
|
@@ -295,6 +310,14 @@ interface ChatCompletionChunk {
|
|
|
295
310
|
interface ChatCompletionStream extends AsyncIterable<ChatCompletionChunk> {
|
|
296
311
|
/** Number of memories injected into this request (from X-Cencori-Memory-Retrieved). */
|
|
297
312
|
memoriesRetrieved: number;
|
|
313
|
+
/** Input-guard verdict from the stream-open headers (absent when unscanned). */
|
|
314
|
+
safety?: {
|
|
315
|
+
scanned: boolean;
|
|
316
|
+
input?: {
|
|
317
|
+
safe: boolean;
|
|
318
|
+
riskScore: number;
|
|
319
|
+
};
|
|
320
|
+
};
|
|
298
321
|
}
|
|
299
322
|
declare class Completions {
|
|
300
323
|
private config;
|
|
@@ -429,10 +452,15 @@ declare class ModelsNamespace {
|
|
|
429
452
|
available?: boolean;
|
|
430
453
|
source?: string;
|
|
431
454
|
connection_id?: string;
|
|
455
|
+
limit?: number;
|
|
456
|
+
cursor?: string;
|
|
432
457
|
}): Promise<{
|
|
433
458
|
object: string;
|
|
434
459
|
data: UnifiedModel[];
|
|
435
460
|
providers: unknown[];
|
|
461
|
+
total: number;
|
|
462
|
+
next_cursor: string | null;
|
|
463
|
+
partial: boolean;
|
|
436
464
|
}>;
|
|
437
465
|
}
|
|
438
466
|
declare class ProviderConnectionsNamespace {
|
|
@@ -525,7 +553,11 @@ declare class InstallationsNamespace {
|
|
|
525
553
|
connection_ids?: string[];
|
|
526
554
|
approval_policy?: Record<string, unknown>;
|
|
527
555
|
}): Promise<unknown>;
|
|
528
|
-
list(tenantId?: string
|
|
556
|
+
list(tenantId?: string, params?: {
|
|
557
|
+
agent_id?: string;
|
|
558
|
+
limit?: number;
|
|
559
|
+
cursor?: string;
|
|
560
|
+
}): Promise<{
|
|
529
561
|
data: unknown[];
|
|
530
562
|
next_cursor: string | null;
|
|
531
563
|
}>;
|
|
@@ -549,6 +581,13 @@ declare class RunsNamespace {
|
|
|
549
581
|
response_format?: unknown;
|
|
550
582
|
session_id?: string;
|
|
551
583
|
}, idempotencyKey?: string, options?: EmbeddedRequestOptions): Promise<unknown>;
|
|
584
|
+
history(agentId: string, params?: {
|
|
585
|
+
limit?: number;
|
|
586
|
+
cursor?: string;
|
|
587
|
+
}): Promise<{
|
|
588
|
+
data: unknown[];
|
|
589
|
+
next_cursor: string | null;
|
|
590
|
+
}>;
|
|
552
591
|
get(runId: string, options?: EmbeddedRequestOptions): Promise<unknown>;
|
|
553
592
|
events(runId: string, params?: {
|
|
554
593
|
after?: string;
|
|
@@ -777,6 +816,27 @@ declare class McpServersNamespace {
|
|
|
777
816
|
}>;
|
|
778
817
|
refreshTools(serverId: string): Promise<unknown>;
|
|
779
818
|
}
|
|
819
|
+
declare class MarketplaceNamespace {
|
|
820
|
+
private config;
|
|
821
|
+
constructor(config: Required<CencoriConfig>);
|
|
822
|
+
list(params?: {
|
|
823
|
+
limit?: number;
|
|
824
|
+
cursor?: string;
|
|
825
|
+
}): Promise<{
|
|
826
|
+
data: unknown[];
|
|
827
|
+
next_cursor: string | null;
|
|
828
|
+
}>;
|
|
829
|
+
get(versionId: string): Promise<unknown>;
|
|
830
|
+
install(params: {
|
|
831
|
+
version_id: string;
|
|
832
|
+
tenant_id: string;
|
|
833
|
+
knowledge_base_ids?: string[];
|
|
834
|
+
connection_ids?: string[];
|
|
835
|
+
approval_policy?: Record<string, unknown>;
|
|
836
|
+
budget?: Record<string, unknown>;
|
|
837
|
+
overlay_config?: Record<string, unknown>;
|
|
838
|
+
}): Promise<unknown>;
|
|
839
|
+
}
|
|
780
840
|
declare class WebhooksNamespace {
|
|
781
841
|
private config;
|
|
782
842
|
constructor(config: Required<CencoriConfig>);
|
|
@@ -809,16 +869,27 @@ declare class UsageNamespace {
|
|
|
809
869
|
constructor(config: Required<CencoriConfig>);
|
|
810
870
|
summary(params?: {
|
|
811
871
|
days?: number;
|
|
872
|
+
since?: string;
|
|
873
|
+
until?: string;
|
|
812
874
|
tenant_id?: string;
|
|
813
875
|
agent_id?: string;
|
|
876
|
+
installation_id?: string;
|
|
877
|
+
model?: string;
|
|
814
878
|
}): Promise<{
|
|
815
879
|
totals: unknown;
|
|
816
880
|
groups: unknown[];
|
|
881
|
+
truncated: boolean;
|
|
882
|
+
row_cap: number;
|
|
883
|
+
unresolved_rows: number;
|
|
817
884
|
}>;
|
|
818
885
|
events(params?: {
|
|
819
886
|
days?: number;
|
|
887
|
+
since?: string;
|
|
888
|
+
until?: string;
|
|
820
889
|
tenant_id?: string;
|
|
821
890
|
agent_id?: string;
|
|
891
|
+
installation_id?: string;
|
|
892
|
+
model?: string;
|
|
822
893
|
limit?: number;
|
|
823
894
|
cursor?: string;
|
|
824
895
|
}): Promise<{
|
|
@@ -1057,6 +1128,7 @@ declare class Cencori {
|
|
|
1057
1128
|
readonly knowledge: KnowledgeNamespace;
|
|
1058
1129
|
readonly connections: ConnectionsNamespace;
|
|
1059
1130
|
readonly mcpServers: McpServersNamespace;
|
|
1131
|
+
readonly marketplace: MarketplaceNamespace;
|
|
1060
1132
|
readonly skills: SkillsNamespace;
|
|
1061
1133
|
readonly skillImports: SkillImportsNamespace;
|
|
1062
1134
|
readonly webhooks: WebhooksNamespace;
|
|
@@ -1107,32 +1179,54 @@ declare class Cencori {
|
|
|
1107
1179
|
/**
|
|
1108
1180
|
* Cencori Error Classes
|
|
1109
1181
|
*
|
|
1110
|
-
* Custom error types for better error handling
|
|
1182
|
+
* Custom error types for better error handling. Every API failure carries
|
|
1183
|
+
* the HTTP status, the machine-readable code, the request id (for support
|
|
1184
|
+
* correlation), and any retry hint the server sent — so callers never have
|
|
1185
|
+
* to guess from a bare message again.
|
|
1111
1186
|
*/
|
|
1112
1187
|
declare class CencoriError extends Error {
|
|
1113
1188
|
statusCode?: number | undefined;
|
|
1114
1189
|
code?: string | undefined;
|
|
1115
|
-
|
|
1190
|
+
options?: {
|
|
1191
|
+
requestId?: string | null;
|
|
1192
|
+
retryAfterMs?: number | null;
|
|
1193
|
+
errorBody?: unknown;
|
|
1194
|
+
} | undefined;
|
|
1195
|
+
constructor(message: string, statusCode?: number | undefined, code?: string | undefined, options?: {
|
|
1196
|
+
requestId?: string | null;
|
|
1197
|
+
retryAfterMs?: number | null;
|
|
1198
|
+
errorBody?: unknown;
|
|
1199
|
+
} | undefined);
|
|
1200
|
+
/** Request id for support correlation (X-Request-Id), when the server sent one. */
|
|
1201
|
+
get requestId(): string | null;
|
|
1202
|
+
/** Server-advised wait before retrying, when sent (Retry-After / retry_after_ms). */
|
|
1203
|
+
get retryAfterMs(): number | null;
|
|
1204
|
+
/** True for failures worth retrying: rate limits, bad gateway, unavailable, timeouts. */
|
|
1205
|
+
get isRetryable(): boolean;
|
|
1116
1206
|
}
|
|
1117
1207
|
declare class AuthenticationError extends CencoriError {
|
|
1118
|
-
constructor(message?: string
|
|
1208
|
+
constructor(message?: string, options?: {
|
|
1209
|
+
requestId?: string | null;
|
|
1210
|
+
});
|
|
1119
1211
|
}
|
|
1120
1212
|
declare class RateLimitError extends CencoriError {
|
|
1121
1213
|
retryAfterSeconds?: number | null | undefined;
|
|
1122
|
-
constructor(message?: string, retryAfterSeconds?: number | null | undefined
|
|
1214
|
+
constructor(message?: string, retryAfterSeconds?: number | null | undefined, options?: {
|
|
1215
|
+
requestId?: string | null;
|
|
1216
|
+
errorBody?: unknown;
|
|
1217
|
+
});
|
|
1123
1218
|
}
|
|
1124
1219
|
declare class SafetyError extends CencoriError {
|
|
1125
1220
|
reasons?: string[] | undefined;
|
|
1126
|
-
constructor(message?: string, reasons?: string[] | undefined
|
|
1221
|
+
constructor(message?: string, reasons?: string[] | undefined, options?: {
|
|
1222
|
+
requestId?: string | null;
|
|
1223
|
+
errorBody?: unknown;
|
|
1224
|
+
});
|
|
1127
1225
|
}
|
|
1128
1226
|
|
|
1129
1227
|
/**
|
|
1130
1228
|
* Utility functions for Cencori SDK
|
|
1131
1229
|
*/
|
|
1132
|
-
/**
|
|
1133
|
-
* Fetch with automatic retry on 5xx errors
|
|
1134
|
-
* Uses exponential backoff: 1s, 2s, 4s
|
|
1135
|
-
*/
|
|
1136
1230
|
declare function fetchWithRetry(url: string, options: RequestInit, maxRetries?: number): Promise<Response>;
|
|
1137
1231
|
|
|
1138
1232
|
export { AINamespace, ActionsNamespace, type Agent, type AgentConfig, type AgentKey, type AgentListItem, AgentVersionsNamespace, AgentsNamespace, AuthenticationError, Cencori, CencoriConfig, CencoriEmbeddedApiError, CencoriError, type ChatCompletionChunk, type ChatCompletionCreateParams, type ChatCompletionResponse, type ChatCompletionStream, type ChatMemoryOptions, ChatNamespace, ClientTokensNamespace, ComputeNamespace, ConnectionsNamespace, type CreateAgentKeyParams, type CreateAgentParams, type CreateSessionParams, DocumentsNamespace, type EmbeddedRequestOptions, EndUsersNamespace, InstallationsNamespace, KnowledgeNamespace, McpServersNamespace, MemoryClient, ModelsNamespace, type PaginatedResponse, ProviderConnectionsNamespace, RateLimitError, RatePlansNamespace, RequestOptions, RunsNamespace, SafetyError, type Session, type SessionEvent, type SessionListParams, SessionsNamespace, SkillImportsNamespace, SkillsNamespace, StorageNamespace, TelemetryClient, type Tenant, TenantsNamespace, type TurnParams, type UnifiedModel, type UpdateAgentParams, UsageNamespace, VisionNamespace, VoiceNamespace, WebNamespace, WebhooksNamespace, WorkflowNamespace, Cencori as default, fetchWithRetry };
|