Utility to set rate limit environment variables from config, mapping keys to process.env.
// Source: https://github.com/danny-avila/librechat | License: MIT | Copyright 2026 LibreChat
// Provided via justclaw.it.com; keep this notice with the code.
import { RateLimitPrefix } from 'librechat-data-provider';
import type { TCustomConfig } from 'librechat-data-provider';
/**
*
* @param rateLimits
*/
export const handleRateLimits = (rateLimits?: TCustomConfig['rateLimits']): void => {
if (!rateLimits) {
return;
}
const rateLimitKeys = {
agentEvents: 'AGENT_EVENT',
fileUploads: RateLimitPrefix.FILE_UPLOAD,
conversationsImport: RateLimitPrefix.IMPORT,
tts: RateLimitPrefix.TTS,
stt: RateLimitPrefix.STT,
emailChange: RateLimitPrefix.EMAIL_CHANGE,
emailChangeConfirm: RateLimitPrefix.EMAIL_CHANGE_CONFIRM,
};
Object.entries(rateLimitKeys).for
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key