Salud IA Bot is configured entirely through environment variables, validated at startup by a Joi schema defined inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/RubenDarioGuerreroNeira/Ecosistema-IA-Colombia/llms.txt
Use this file to discover all available pages before exploring further.
AppModule. This page documents every supported variable, explains how to obtain the required credentials, and shows the complete .env file format.
Environment Variables
Required
The Telegram Bot API token issued by @BotFather. This token authenticates the NestJS server against the Telegram Bot API and identifies which bot receives updates.Example:
1234567890:AABBCCDDEEFFaabbccddeeff-GGHHIIJJKKllAPI key for OpenRouter.ai. Used by
GenkitService to authenticate all chat completion requests to the LLaMA model. The key is passed directly to the OpenAI-compatible SDK with baseURL set to https://openrouter.ai/api/v1.Example: sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxOptional
The OpenRouter model identifier used for all AI completions. Any model available on OpenRouter can be substituted here — the only requirement is compatibility with the OpenAI Chat Completions API format.Default:
nvidia/nemotron-3-super-120b-a12b:freeExample alternatives:meta-llama/Meta-Llama-3.1-70B-Instruct— Meta LLaMA 3.1 70B, high-quality responses (paid)meta-llama/Meta-Llama-3.1-8B-Instruct— faster, lower cost, slightly less capable
The HTTP port on which the NestJS server listens. Useful when deploying to a platform (Render, Railway, Fly.io) that injects a
PORT environment variable automatically.Default: 3000An HTTP proxy URL used to route all Telegram API calls through an intermediate proxy. Useful on hosting providers where outbound connections to
api.telegram.org are blocked or restricted. The proxy is applied via https-proxy-agent in the TelegrafModule factory.Format: http://user:password@host:portExample: http://myuser:mypassword@proxy.example.com:8080Timeout in milliseconds for Telegram API calls. Increase this value if you are experiencing timeout errors on slow networks or when the bot sends large batches of fragmented messages.Default:
30000 (30 seconds)Example: 60000 (60 seconds, as suggested in .env.example)The base URL for the OpenRouter API, validated by Joi at startup. Note that
GenkitService currently hardcodes https://openrouter.ai/api/v1 directly and does not read this variable at runtime — override this only if you modify the service to consume it from ConfigService.Default: https://openrouter.ai/api/v1Legacy Variables
The
.env.example file in the repository contains GOOGLE_GENAI_API_KEY. This variable is a legacy artifact from an earlier Gemini-based implementation and is not present in the Joi validation schema. It has no effect on the running application and can be safely ignored or removed from your .env file. The application uses OPENROUTER_API_KEY exclusively for all AI calls.Joi Validation
The app uses Joi to validate all environment variables at startup via NestJS
ConfigModule. If a required variable (TELEGRAM_BOT_TOKEN or OPENROUTER_API_KEY) is missing or empty, the process will exit immediately with a clear validation error message — it will never start in a misconfigured state. Optional variables with defaults are automatically populated by Joi, so you do not need to specify them in .env unless you want non-default values.src/app.module.ts) is:
Complete .env Example
Getting Your Credentials
Telegram Bot Token
Open Telegram and find BotFather
Open the Telegram app on any device. In the search bar, type
@BotFather and open the official verified account (blue checkmark).Create a new bot
Send the command
/newbot. BotFather will prompt you for:- A display name for your bot (e.g.,
Salud IA Colombia) - A username ending in
bot(e.g.,saludiacolombia_bot)
OpenRouter API Key
Sign up at OpenRouter
Go to openrouter.ai and create a free account. OpenRouter provides access to dozens of LLM providers, including Meta LLaMA 3.1, under a single unified API.
Navigate to API Keys
Once logged in, open the Keys section from the top navigation or your account dashboard.
Create a new key
Click Create Key, give it a descriptive name (e.g.,
salud-ia-bot-local), and copy the generated key immediately — it will not be shown again in full.Retry and Fault Tolerance
GenkitService implements automatic retry logic for transient OpenRouter errors. On HTTP 429 (rate limit) or 503 (service unavailable) responses, the service retries up to 3 times with exponential backoff (1 s, 2 s, 4 s). If all retries are exhausted, the error is surfaced to the caller and logged.