@tejasa97/pi-orcarouter-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/README.md CHANGED
@@ -46,12 +46,20 @@ The static fallback includes:
46
46
 
47
47
  | Model | Reasoning | Input | Context | Max output |
48
48
  | ----- | --------- | ----- | ------- | ---------- |
49
- | `z-ai/glm-5.3-flash-free` | always-on | text + image | 1M | 128K |
49
+ | `z-ai/glm-5.3-flash-free` | always-on | text + image | 110K* | 128K |
50
50
  | `z-ai/glm-5.3-flash` | always-on | text + image | 1M | 128K |
51
51
  | `z-ai/glm-5.3` | always-on | text | 1M | 128K |
52
52
  | `deepseek/deepseek-v4-flash-free` | yes | text | 164K | 32K |
53
53
  | `tencent/hy3-free` | yes | text | 128K | 32K |
54
54
 
55
+ ## Free-tier limits
56
+
57
+ `z-ai/glm-5.3-flash-free` is $0 per request, but OrcaRouter gates it:
58
+
59
+ - **Single-request prompt cap ~122K tokens.** The catalog advertises a 1M context, but prompts above roughly 122K tokens are rejected with `free_rate_limited` ("This prompt is longer than the free tier allows for a single request"). The provider registers the model with a 110K context window so Pi keeps sessions under the cap (Pi's system prompt and tool definitions consume part of it).
60
+ - **Rolling usage gate.** After sustained heavy usage the same `free_rate_limited` error appears even for smaller prompts. It clears on its own after a quiet period.
61
+ - **Transient DNS failures.** `api.orcarouter.ai` (EdgeOne CDN) intermittently fails to resolve, surfacing in Pi as "Connection error." Retrying after a minute usually works.
62
+
55
63
  ## GLM-5 notes
56
64
 
57
65
  Verified against the live endpoint:
@@ -50,6 +50,15 @@ export interface RemoteModelEntry {
50
50
 
51
51
  const ZERO_COST = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 };
52
52
 
53
+ export const FREE_GLM_FLASH_ID = "z-ai/glm-5.3-flash-free";
54
+
55
+ /**
56
+ * The free tier rejects single requests whose prompt exceeds ~122K tokens
57
+ * (measured empirically; the catalog claims 1M). pi adds its own system
58
+ * prompt and tool definitions on top, so the honest usable window is lower.
59
+ */
60
+ export const FREE_TIER_CONTEXT_WINDOW = 110_000;
61
+
53
62
  /** Model ids that are clearly not chat-completions models. */
54
63
  const NON_CHAT_ID = /(image|video|kling|dub|tts|speech|sora|whisper|embed|dall|flux|veo|seedance|stable|diffusion|audio|voice|music|rerank)/i;
55
64
 
@@ -254,9 +263,11 @@ function buildModel(id: string, entry: RemoteModelEntry | undefined, baseUrl: st
254
263
  cost: buildCost(entry?.pricing),
255
264
  compat: buildCompat(reasoning),
256
265
  contextWindow:
257
- numberValue(entry?.context_length) ??
258
- numberValue(entry?.top_provider?.context_length) ??
259
- defaultContextWindow(id),
266
+ id === FREE_GLM_FLASH_ID
267
+ ? FREE_TIER_CONTEXT_WINDOW
268
+ : numberValue(entry?.context_length) ??
269
+ numberValue(entry?.top_provider?.context_length) ??
270
+ defaultContextWindow(id),
260
271
  maxTokens:
261
272
  numberValue(entry?.max_completion_tokens) ??
262
273
  numberValue(entry?.top_provider?.max_completion_tokens) ??
@@ -269,7 +280,7 @@ function buildModel(id: string, entry: RemoteModelEntry | undefined, baseUrl: st
269
280
  * /v1/models fetch fails. The free GLM 5.3 Flash tier is the headline model.
270
281
  */
271
282
  export const STATIC_MODEL_IDS = [
272
- "z-ai/glm-5.3-flash-free",
283
+ FREE_GLM_FLASH_ID,
273
284
  "z-ai/glm-5.3-flash",
274
285
  "z-ai/glm-5.3",
275
286
  "deepseek/deepseek-v4-flash-free",
@@ -280,13 +291,11 @@ export function buildStaticModels(baseUrl: string): readonly OrcaRouterModel[] {
280
291
  return STATIC_MODEL_IDS.map((id) =>
281
292
  buildModel(
282
293
  id,
283
- id === "z-ai/glm-5.3-flash-free"
294
+ id === FREE_GLM_FLASH_ID
284
295
  ? {
285
296
  id,
286
297
  supported_endpoint_types: null,
287
298
  name: "Z.ai: GLM 5.3 Flash (Free)",
288
- context_length: 1_000_000,
289
- max_completion_tokens: 128_000,
290
299
  architecture: { input_modalities: ["text", "image", "video"] },
291
300
  pricing: { request: "0.000000" },
292
301
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tejasa97/pi-orcarouter-provider",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Pi provider package for OrcaRouter (GLM 5.3 Flash Free, DeepSeek, Kimi, and more) — OpenAI-compatible gateway with dynamic model discovery.",
5
5
  "type": "module",
6
6
  "engines": {