Mintplex-Labs/anything-llm · critical · Error
No Gitee AI API key was set.
Error message
No Gitee AI API key was set.
What it means
Thrown by the GiteeAILLM constructor when process.env.GITEE_AI_API_KEY is unset. Gitee AI (ai.gitee.com/v1) is an OpenAI-compatible serverless inference platform that requires the API key as the bearer token; without it the OpenAI client cannot authenticate.
Source
Thrown at server/utils/AiProviders/giteeai/index.js:21
const { safeJsonParse, toValidNumber } = require("../../http");
const LEGACY_MODEL_MAP = require("../modelMap/legacy");
const { NativeEmbedder } = require("../../EmbeddingEngines/native");
const {
LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");
const {
handleDefaultStreamResponseV2,
} = require("../../helpers/chat/responses");
const cacheFolder = path.resolve(
process.env.STORAGE_DIR
? path.resolve(process.env.STORAGE_DIR, "models", "giteeai")
: path.resolve(__dirname, `../../../storage/models/giteeai`)
);
class GiteeAILLM {
constructor(embedder = null, modelPreference = null) {
if (!process.env.GITEE_AI_API_KEY)
throw new Error("No Gitee AI API key was set.");
const { OpenAI: OpenAIApi } = require("openai");
this.className = "GiteeAILLM";
this.openai = new OpenAIApi({
apiKey: process.env.GITEE_AI_API_KEY,
baseURL: "https://ai.gitee.com/v1",
});
this.model = modelPreference || process.env.GITEE_AI_MODEL_PREF || "";
this.limits = {
history: this.promptWindowLimit() * 0.15,
system: this.promptWindowLimit() * 0.15,
user: this.promptWindowLimit() * 0.7,
};
this.embedder = embedder ?? new NativeEmbedder();
this.defaultTemp = 0.7;
if (!fs.existsSync(cacheFolder))View on GitHub (pinned to 526360e320)
Solutions
- Generate a token in the Gitee AI console and set GITEE_AI_API_KEY in .env
- Restart AnythingLLM so process.env reloads
- Verify the token with curl https://ai.gitee.com/v1/models -H 'Authorization: Bearer <key>'
- Pass the env var through in containerized deployments
Example fix
// before // .env: GITEE_AI_MODEL_PREF=Qwen2.5-7B-Instruct // no key // after // .env: // GITEE_AI_API_KEY=<token from console> // GITEE_AI_MODEL_PREF=Qwen2.5-7B-Instruct
Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.GITEE_AI_API_KEY) {
throw new ConfigError('Generate a Gitee AI token and set GITEE_AI_API_KEY.');
} Prevention
- Validate the key with GET /v1/models at startup
- Keep Gitee AI credentials in a secrets manager for production
- Surface missing-key in the UI before first chat
When it happens
Trigger: Constructing `new GiteeAILLM(embedder, modelPreference)` while GITEE_AI_API_KEY is absent. Fires at provider selection when the user picked Gitee AI but supplied no key.
Common situations: .env missing GITEE_AI_API_KEY; key not yet generated in the Gitee AI console; key revoked; Docker deployment without env passthrough; account region/access restrictions.
Related errors
- No Gemini API key was set.
- No Groq API key was set.
- No Foundry Base Path was set.
- GenericOpenAI must have a valid base path to use for the api
- KoboldCPP must have a valid base path to use for the api.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/d3465f4b7a2a5247.
Report an issue: GitHub.