@juvio15/pi-cliproxyapi-provider 0.1.0 → 0.1.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/package.json
CHANGED
package/src/core/index.ts
CHANGED
|
@@ -23,9 +23,12 @@
|
|
|
23
23
|
* resetCooldowns(options: ResetCooldownsOptions): Promise<string[]>
|
|
24
24
|
* unavailableModels(usage: readonly ProviderUsage[], exhausted: Readonly<Record<string, number>>, now?: number): Map<string, number>
|
|
25
25
|
*/
|
|
26
|
-
|
|
27
|
-
import {
|
|
28
|
-
|
|
26
|
+
// pi maps only some pi-ai entry points into extensions. compat re-exports the same lazy API factories.
|
|
27
|
+
import {
|
|
28
|
+
anthropicMessagesApi,
|
|
29
|
+
openAICompletionsApi,
|
|
30
|
+
openAIResponsesApi,
|
|
31
|
+
} from "@earendil-works/pi-ai/compat";
|
|
29
32
|
import { createProvider } from "@earendil-works/pi-ai/models";
|
|
30
33
|
import type { Provider } from "@earendil-works/pi-ai/models";
|
|
31
34
|
|
package/src/extension/prices.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
|
|
3
|
-
import { ModelCostSchema } from "@earendil-works/pi-ai/providers/model-schema";
|
|
4
3
|
import { Type } from "typebox";
|
|
5
4
|
import type { Static } from "typebox";
|
|
6
5
|
|
|
@@ -22,6 +21,21 @@ const MINUTE_MS = 60_000;
|
|
|
22
21
|
const HOUR_MS = 60 * MINUTE_MS;
|
|
23
22
|
const DAY_MS = 24 * HOUR_MS;
|
|
24
23
|
|
|
24
|
+
const RateFields = {
|
|
25
|
+
cacheRead: Type.Number(),
|
|
26
|
+
cacheWrite: Type.Number(),
|
|
27
|
+
input: Type.Number(),
|
|
28
|
+
output: Type.Number(),
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** pi-ai's ModelCost. pi does not expose pi-ai's model-schema module to extensions, and typecheck holds this to ModelCost where the file feeds costCatalogFromPrices. */
|
|
32
|
+
const ModelCostSchema = Type.Object({
|
|
33
|
+
...RateFields,
|
|
34
|
+
tiers: Type.Optional(
|
|
35
|
+
Type.Array(Type.Object({ ...RateFields, inputTokensAbove: Type.Number() }))
|
|
36
|
+
),
|
|
37
|
+
});
|
|
38
|
+
|
|
25
39
|
const PricesFileSchema = Type.Object({
|
|
26
40
|
etag: Type.Optional(Type.String()),
|
|
27
41
|
fetchedAt: Type.Number(),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ModelPromptCache } from "@earendil-works/pi-ai";
|
|
2
|
-
import {
|
|
2
|
+
import { getBuiltinModels } from "@earendil-works/pi-ai/providers/all";
|
|
3
3
|
|
|
4
4
|
const LIFETIMES = new Map<string, ModelPromptCache | undefined>(
|
|
5
|
-
|
|
5
|
+
getBuiltinModels("anthropic").map((model) => [model.id, model.promptCache])
|
|
6
6
|
);
|
|
7
7
|
|
|
8
8
|
/** pi-ai's own Anthropic lifetimes, matched on the id or its segment after the last "/". */
|