pi-free 1.0.3 → 1.0.5
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 +40 -14
- package/package.json +1 -1
- package/providers/nvidia.ts +18 -2
- package/usage/formatters.ts +2 -18
- package/usage/limits.ts +3 -21
- package/usage/types.ts +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.5] - 2025-04-03
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- **NVIDIA provider non-chat model filtering** (comment/implementation mismatch)
|
|
14
|
+
- Added modalities-based filtering to exclude embedding, speech-to-text, OCR, and image-gen models
|
|
15
|
+
- Filters models where `output` is not `["text"]` (e.g., image generation like `black-forest-labs/flux.1-dev`)
|
|
16
|
+
- Filters models where `input` lacks `"text"` (e.g., OCR like `nvidia/nemoretriever-ocr-v1`, speech-to-text like `openai/whisper-large-v3`)
|
|
17
|
+
- Updated file comment to accurately describe the filtering behavior
|
|
18
|
+
- Added 8 comprehensive unit tests for model filtering logic
|
|
19
|
+
|
|
20
|
+
## [1.0.4] - 2025-04-03
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- **All tests now passing** (127/127)
|
|
24
|
+
- Fixed mock paths in kilo.test.ts, zen.test.ts, ollama.test.ts
|
|
25
|
+
- Fixed createCtxReRegister mocks in zen.test.ts and openrouter.test.ts
|
|
26
|
+
- Fixed cline.test.ts to test actual provider re-registration behavior
|
|
27
|
+
- Added missing DEFAULT_MIN_SIZE_B constant to openrouter mock
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- **Code quality improvements**
|
|
31
|
+
- Refactored usage modules to break circular dependency (limits.ts ↔ formatters.ts)
|
|
32
|
+
- Created usage/types.ts with shared interfaces (FreeTierLimit, FreeTierUsage)
|
|
33
|
+
- Bumped version to 1.0.4
|
|
34
|
+
|
|
35
|
+
## [1.0.3] - 2025-04-03
|
|
36
|
+
|
|
37
|
+
### Changed
|
|
38
|
+
- Updated package.json metadata (name, description, keywords, repository URL)
|
|
39
|
+
- Updated .npmignore for cleaner publishes
|
|
40
|
+
|
|
41
|
+
## [1.0.0] - 2024-03-28
|
|
42
|
+
|
|
10
43
|
### Added
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
44
|
+
- Initial release with 6 providers: Kilo, Zen, OpenRouter, NVIDIA, Cline, Fireworks
|
|
45
|
+
- Free tier usage tracking across all sessions
|
|
46
|
+
- Provider failover with model hopping
|
|
47
|
+
- Autocompact integration for rate limit recovery
|
|
48
|
+
- Usage widget with glimpseui
|
|
49
|
+
- Command toggles for free/all model filtering
|
|
50
|
+
- Hardcoded benchmark data from Artificial Analysis
|
|
14
51
|
|
|
15
52
|
### Changed
|
|
16
53
|
- **Major refactoring**: Split free-tier-limits.ts into usage/* modules
|
|
@@ -46,14 +83,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
46
83
|
- fetchWithRetry() now properly throws after exhausting retries
|
|
47
84
|
- Auth error pattern matching now handles more message variants
|
|
48
85
|
- Test isolation for free-tier-limits tests
|
|
49
|
-
|
|
50
|
-
## [1.0.0] - 2024-03-28
|
|
51
|
-
|
|
52
|
-
### Added
|
|
53
|
-
- Initial release with 6 providers: Kilo, Zen, OpenRouter, NVIDIA, Cline, Fireworks
|
|
54
|
-
- Free tier usage tracking across all sessions
|
|
55
|
-
- Provider failover with model hopping
|
|
56
|
-
- Autocompact integration for rate limit recovery
|
|
57
|
-
- Usage widget with glimpseui
|
|
58
|
-
- Command toggles for free/all model filtering
|
|
59
|
-
- Hardcoded benchmark data from Artificial Analysis
|
package/package.json
CHANGED
package/providers/nvidia.ts
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* All models use NVIDIA's free credit system — requires NVIDIA_API_KEY.
|
|
6
6
|
* Get a free key at: https://build.nvidia.com
|
|
7
7
|
*
|
|
8
|
-
* Small models (< 70B)
|
|
9
|
-
*
|
|
8
|
+
* Small models (< 70B) are filtered out to keep the list focused on useful
|
|
9
|
+
* chat/coding models. Non-chat models (embedding, speech-to-text, OCR,
|
|
10
|
+
* image-gen) are filtered by their modalities (output must be ["text"],
|
|
11
|
+
* input must include "text").
|
|
10
12
|
*
|
|
11
13
|
* Set NVIDIA_SHOW_PAID=true to show paid-tier models (same key, uses credits).
|
|
12
14
|
*/
|
|
@@ -52,6 +54,20 @@ async function fetchNvidiaModels(): Promise<ProviderModelConfig[]> {
|
|
|
52
54
|
const result = applyHidden(
|
|
53
55
|
Object.values(provider.models)
|
|
54
56
|
.filter((m) => isUsableModel(m.id, NVIDIA_MIN_SIZE_B))
|
|
57
|
+
.filter((m) => {
|
|
58
|
+
// Filter non-chat models by modalities
|
|
59
|
+
// Embedding, speech-to-text, OCR, and image-gen models are excluded
|
|
60
|
+
const modalities = m.modalities;
|
|
61
|
+
if (modalities) {
|
|
62
|
+
const output = modalities.output ?? [];
|
|
63
|
+
const input = modalities.input ?? [];
|
|
64
|
+
// Exclude models that don't output text (e.g., image generation)
|
|
65
|
+
if (!output.includes("text")) return false;
|
|
66
|
+
// Exclude models that don't accept text input (e.g., pure OCR, speech-to-text)
|
|
67
|
+
if (!input.includes("text")) return false;
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
})
|
|
55
71
|
.filter((m) => {
|
|
56
72
|
// All NVIDIA models are credit-based (no hard cost.input = 0 distinction).
|
|
57
73
|
// Respect NVIDIA_SHOW_PAID: without the flag, only expose models marked free.
|
package/usage/formatters.ts
CHANGED
|
@@ -3,25 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import type { CumulativeUsageReport } from "./cumulative.ts";
|
|
6
|
-
import {
|
|
7
|
-
type FreeTierLimit,
|
|
8
|
-
getFreeTierUsage,
|
|
9
|
-
getLimitWarning,
|
|
10
|
-
} from "./limits.ts";
|
|
6
|
+
import { getFreeTierUsage, getLimitWarning } from "./limits.ts";
|
|
11
7
|
import type { SessionUsageReport } from "./tracking.ts";
|
|
12
|
-
|
|
13
|
-
export interface FreeTierUsage {
|
|
14
|
-
provider: string;
|
|
15
|
-
requestsToday: number;
|
|
16
|
-
requestsThisHour: number;
|
|
17
|
-
requestsThisMonth?: number;
|
|
18
|
-
limit: FreeTierLimit;
|
|
19
|
-
remainingToday?: number;
|
|
20
|
-
remainingThisHour?: number;
|
|
21
|
-
remainingThisMonth?: number;
|
|
22
|
-
percentUsed: number;
|
|
23
|
-
status: "ok" | "warning" | "critical" | "unknown";
|
|
24
|
-
}
|
|
8
|
+
// Types imported via limits.ts (which re-exports from types.ts)
|
|
25
9
|
|
|
26
10
|
export function formatSessionUsage(report: SessionUsageReport): string {
|
|
27
11
|
if (report.providers.length === 0) {
|
package/usage/limits.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { createLogger } from "../lib/logger.ts";
|
|
11
11
|
import { getDailyRequestCount } from "./metrics.ts";
|
|
12
|
+
import type { FreeTierLimit, FreeTierUsage } from "./types.ts";
|
|
12
13
|
|
|
13
14
|
export {
|
|
14
15
|
type CumulativeUsageReport,
|
|
@@ -30,6 +31,8 @@ export {
|
|
|
30
31
|
resetUsageStats,
|
|
31
32
|
type SessionUsageReport,
|
|
32
33
|
} from "./tracking.ts";
|
|
34
|
+
// Re-export types for consumers
|
|
35
|
+
export type { FreeTierLimit, FreeTierUsage } from "./types.ts";
|
|
33
36
|
|
|
34
37
|
const _logger = createLogger("free-tier");
|
|
35
38
|
|
|
@@ -37,14 +40,6 @@ const _logger = createLogger("free-tier");
|
|
|
37
40
|
// Free Tier Limits Configuration
|
|
38
41
|
// =============================================================================
|
|
39
42
|
|
|
40
|
-
export interface FreeTierLimit {
|
|
41
|
-
provider: string;
|
|
42
|
-
requestsPerDay?: number;
|
|
43
|
-
requestsPerHour?: number;
|
|
44
|
-
requestsPerMonth?: number;
|
|
45
|
-
description: string;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
43
|
export const FREE_TIER_LIMITS: Record<string, FreeTierLimit> = {
|
|
49
44
|
kilo: {
|
|
50
45
|
provider: "kilo",
|
|
@@ -80,19 +75,6 @@ export const FREE_TIER_LIMITS: Record<string, FreeTierLimit> = {
|
|
|
80
75
|
// Usage Status and Warnings
|
|
81
76
|
// =============================================================================
|
|
82
77
|
|
|
83
|
-
export interface FreeTierUsage {
|
|
84
|
-
provider: string;
|
|
85
|
-
requestsToday: number;
|
|
86
|
-
requestsThisHour: number;
|
|
87
|
-
requestsThisMonth?: number;
|
|
88
|
-
limit: FreeTierLimit;
|
|
89
|
-
remainingToday?: number;
|
|
90
|
-
remainingThisHour?: number;
|
|
91
|
-
remainingThisMonth?: number;
|
|
92
|
-
percentUsed: number;
|
|
93
|
-
status: "ok" | "warning" | "critical" | "unknown";
|
|
94
|
-
}
|
|
95
|
-
|
|
96
78
|
export function getFreeTierUsage(provider: string): FreeTierUsage {
|
|
97
79
|
const limit = FREE_TIER_LIMITS[provider];
|
|
98
80
|
if (!limit) {
|
package/usage/types.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for usage tracking modules
|
|
3
|
+
*
|
|
4
|
+
* Extracted to break circular dependency between limits.ts and formatters.ts
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface FreeTierLimit {
|
|
8
|
+
provider: string;
|
|
9
|
+
requestsPerDay?: number;
|
|
10
|
+
requestsPerHour?: number;
|
|
11
|
+
requestsPerMonth?: number;
|
|
12
|
+
description: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface FreeTierUsage {
|
|
16
|
+
provider: string;
|
|
17
|
+
requestsToday: number;
|
|
18
|
+
requestsThisHour: number;
|
|
19
|
+
requestsThisMonth?: number;
|
|
20
|
+
limit: FreeTierLimit;
|
|
21
|
+
remainingToday?: number;
|
|
22
|
+
remainingThisHour?: number;
|
|
23
|
+
remainingThisMonth?: number;
|
|
24
|
+
percentUsed: number;
|
|
25
|
+
status: "ok" | "warning" | "critical" | "unknown";
|
|
26
|
+
}
|