|
103 | 103 | "openai/gpt-4o-mini": {"provider": "openrouter", "in": 0.15, "out": 0.60, "label": "GPT-4o-mini"}, |
104 | 104 | "meta-llama/llama-3.3-70b-instruct": {"provider": "openrouter", "in": 0.13, "out": 0.40, "label": "Llama 3.3 70B"}, |
105 | 105 | # Elysiver-hosted GLM — user-paid endpoint, quota-limited, treat cost as $0 to us |
| 106 | + "glm-5.1": {"provider": "elysiver", "in": 0.0, "out": 0.0, "label": "GLM-5.1 (elysiver)"}, |
106 | 107 | "glm-5": {"provider": "elysiver", "in": 0.0, "out": 0.0, "label": "GLM-5 (elysiver)"}, |
107 | 108 | "glm-4.6": {"provider": "elysiver", "in": 0.0, "out": 0.0, "label": "GLM-4.6 (elysiver)"}, |
108 | 109 | } |
109 | 110 |
|
110 | 111 |
|
111 | 112 | def load_env_file(path: Path = None) -> None: |
112 | | - """Minimal .env loader — only sets env vars not already present.""" |
113 | | - if path is None: |
114 | | - path = REPO_ROOT / ".env" |
115 | | - if not path.exists(): |
116 | | - return |
117 | | - for line in path.read_text(encoding="utf-8").splitlines(): |
118 | | - line = line.strip() |
119 | | - if not line or line.startswith("#") or "=" not in line: |
| 113 | + """Minimal env loader — only sets vars not already present. |
| 114 | +
|
| 115 | + Repo convention uses `.env.local` for local secrets, so load that first |
| 116 | + and fall back to `.env` if present. |
| 117 | + """ |
| 118 | + paths = [path] if path is not None else [REPO_ROOT / ".env.local", REPO_ROOT / ".env"] |
| 119 | + for candidate in paths: |
| 120 | + if not candidate.exists(): |
120 | 121 | continue |
121 | | - k, _, v = line.partition("=") |
122 | | - k = k.strip() |
123 | | - v = v.strip().strip('"').strip("'") |
124 | | - if k and k not in os.environ: |
125 | | - os.environ[k] = v |
| 122 | + for line in candidate.read_text(encoding="utf-8").splitlines(): |
| 123 | + line = line.strip() |
| 124 | + if not line or line.startswith("#") or "=" not in line: |
| 125 | + continue |
| 126 | + k, _, v = line.partition("=") |
| 127 | + k = k.strip() |
| 128 | + v = v.strip().strip('"').strip("'") |
| 129 | + if k and k not in os.environ: |
| 130 | + os.environ[k] = v |
126 | 131 |
|
127 | 132 |
|
128 | 133 | def load_api_key_for(provider: str) -> str: |
|
0 commit comments