A Telegram bot that integrates with OpenAI's official ChatGPT, DALL·E and Whisper APIs to provide answers. Ready to use with minimal configuration required.

/reset command/image command/stats command - by @AlexHTWOPENAI_MODEL parameter to gpt-4/setinline commandIf you'd like to help, check out the issues section and contribute!
If you want to help with translations, check out the Translations Manual
PRs are always welcome!
Customize the configuration by copying .env.example and renaming it to .env, then editing the required parameters as desired:
| Parameter | Description |
|---|---|
OPENAI_API_KEY |
Your OpenAI API key, you can get it from here |
TELEGRAM_BOT_TOKEN |
Your Telegram bot's token, obtained using BotFather (see tutorial) |
ADMIN_USER_IDS |
Telegram user IDs of admins. These users have access to special admin commands, information and no budget restrictions. Admin IDs don't have to be added to ALLOWED_TELEGRAM_USER_IDS. Note: by default, no admin (-) |
ALLOWED_TELEGRAM_USER_IDS |
A comma-separated list of Telegram user IDs that are allowed to interact with the bot (use getidsbot to find your user ID). Note: by default, everyone is allowed (*) |
The following parameters are optional and can be set in the .env file:
| Parameter | Description | Default value |
|---|---|---|
BUDGET_PERIOD |
Determines the time frame all budgets are applied to. Available periods: daily (resets budget every day), monthly (resets budgets on the first of each month), all-time (never resets budget). See the Budget Manual for more information |
monthly |
USER_BUDGETS |
A comma-separated list of $-amounts per user from list ALLOWED_TELEGRAM_USER_IDS to set custom usage limit of OpenAI API costs for each. For *- user lists the first USER_BUDGETS value is given to every user. Note: by default, no limits for any user (*). See the Budget Manual for more information |
* |
GUEST_BUDGET |
$-amount as usage limit for all guest users. Guest users are users in group chats that are not in the ALLOWED_TELEGRAM_USER_IDS list. Value is ignored if no usage limits are set in user budgets (USER_BUDGETS=*). See the Budget Manual for more information |
100.0 |
TOKEN_PRICE |
$-price per 1000 tokens used to compute cost information in usage statistics. Source: https://openai.com/pricing | 0.002 |
IMAGE_PRICES |
A comma-separated list with 3 elements of prices for the different image sizes: 256x256, 512x512 and 1024x1024. Source: https://openai.com/pricing |
0.016,0.018,0.02 |
TRANSCRIPTION_PRICE |
USD-price for one minute of audio transcription. Source: https://openai.com/pricing | 0.006 |
VISION_TOKEN_PRICE |
USD-price per 1K tokens of image interpretation. Source: https://openai.com/pricing | 0.01 |
TTS_PRICES |
A comma-separated list with prices for the tts models: tts-1, tts-1-hd. Source: https://openai.com/pricing |
0.015,0.030 |
Check out the Budget Manual for possible budget configurations.
| Parameter | Description | Default value |
|---|---|---|
ENABLE_QUOTING |
Whether to enable message quoting in private chats | true |
ENABLE_IMAGE_GENERATION |
Whether to enable image generation via the /image command |
true |
ENABLE_TRANSCRIPTION |
Whether to enable transcriptions of audio and video messages | true |
ENABLE_TTS_GENERATION |
Whether to enable text to speech generation via the /tts |
true |
ENABLE_VISION |
Whether to enable vision capabilities in supported models | true |
PROXY |
Proxy to be used for OpenAI and Telegram bot (e.g. http://localhost:8080) |
- |
OPENAI_PROXY |
Proxy to be used only for OpenAI (e.g. http://localhost:8080) |
- |
TELEGRAM_PROXY |
Proxy to be used only for Telegram bot (e.g. http://localhost:8080) |
- |
$ claude mcp add chatgpt-telegram-bot \
-- python -m otcore.mcp_server <graph>