Guides
AIChannel Environment Variables
Configure upstream API keys in the Federation environment.
Declare the key on the Channel:
class DeepSeekChannel extends AIChannel {
constructor() {
super({
id: "deepseek",
env: { DEEPSEEK_API_KEY: "DeepSeek API Key" },
base_url: "https://api.deepseek.com/v1",
});
}
protected async stream(input: AIChannelStreamInput) {
const api_key = input.env("DEEPSEEK_API_KEY");
if (!api_key) throw new Error("DEEPSEEK_API_KEY is required");
return stream_openai_compatible_model(input, {
api_key,
base_url: this.base_url ?? "https://api.deepseek.com/v1",
});
}
}env declares the variables shown in the model catalog's admin view. Add multiple entries when a Channel needs more than one value.
Values are stored in Federation's env table and read at execution time with input.env(key). They never enter CityModelDescriptor or the client runtime.