chore(v0.3.0): rename fast-LLM env vars to TIMEWEB_* (match other projects)
Aligns with the user's other repos (proso) which use TIMEWEB_API_GROK / TIMEWEB_URL_GROK. Single naming convention across projects avoids the 'which env var was it for this repo' mental tax. PEPA_FAST_LLM_BASE_URL → TIMEWEB_BASE_URL PEPA_FAST_LLM_API_KEY → TIMEWEB_API_KEY PEPA_FAST_LLM_MODEL → TIMEWEB_MODEL PEPA_FAST_LLM_TIMEOUT_MS → TIMEWEB_TIMEOUT_MS Provider still works with any OpenAI-compatible endpoint — TimeWeb is the default but the variable name doesn't lock us in. Tests + docs + .env / .env.example updated. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+10
-8
@@ -6,19 +6,21 @@
|
||||
// right now ("I'm wedged in a pit, what should I do?").
|
||||
//
|
||||
// This provider opens a parallel path: any OpenAI-compatible HTTP endpoint
|
||||
// (TimeWeb, OpenAI direct, Groq, OpenRouter, local Ollama with the OpenAI
|
||||
// shim, …) producing a structured JSON answer in ≤8 seconds.
|
||||
// (TimeWeb is the default — same env var convention as the user's other
|
||||
// projects — but OpenAI direct, Groq, OpenRouter, and local Ollama with
|
||||
// the OpenAI shim all work with the same plumbing) producing a structured
|
||||
// JSON answer in ≤8 seconds.
|
||||
//
|
||||
// Configuration is strictly env-driven. The provider is a NO-OP unless
|
||||
// PEPA_FAST_LLM_API_KEY is set, so it's safe to ship the code disabled.
|
||||
// TIMEWEB_API_KEY is set, so it's safe to ship the code disabled.
|
||||
|
||||
import { info, warn } from "../log.js";
|
||||
|
||||
const ENV = {
|
||||
BASE_URL: "PEPA_FAST_LLM_BASE_URL",
|
||||
API_KEY: "PEPA_FAST_LLM_API_KEY",
|
||||
MODEL: "PEPA_FAST_LLM_MODEL",
|
||||
TIMEOUT_MS: "PEPA_FAST_LLM_TIMEOUT_MS",
|
||||
BASE_URL: "TIMEWEB_BASE_URL",
|
||||
API_KEY: "TIMEWEB_API_KEY",
|
||||
MODEL: "TIMEWEB_MODEL",
|
||||
TIMEOUT_MS: "TIMEWEB_TIMEOUT_MS",
|
||||
};
|
||||
|
||||
const DEFAULT_BASE_URL = "https://api.openai.com/v1";
|
||||
@@ -58,7 +60,7 @@ export async function complete({
|
||||
}
|
||||
const useModel = model || cfg.model;
|
||||
if (!useModel) {
|
||||
return { ok: false, code: "no_model", detail: `set ${ENV.MODEL} or pass model arg`, latencyMs: 0 };
|
||||
return { ok: false, code: "no_model", detail: `set ${ENV.MODEL} env or pass model arg`, latencyMs: 0 };
|
||||
}
|
||||
|
||||
const body = {
|
||||
|
||||
Reference in New Issue
Block a user