You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fa59b0a
Browse filesBrowse the repository at this point in the historyBrowse files
Add repository-root VERSION as the single source of truth for the ChatKeke release version.
Runtime startup output, /about, and the DuckDuckGo User-Agent now load the application version from VERSION instead of duplicating it in source files.
Add regression coverage and document the release-version convention.
Copy file name to clipboardExpand all lines: README.md
+67-8Lines changed: 67 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,8 @@
2
2
3
3
## 🤖 _Powered by ChatKeke_ 🚀
4
4
5
+
> **Required OpenAI key migration:** OpenAI scheduled legacy user API keys for deactivation on **October 22, 2026**. Affected installations must create a key inside the intended OpenAI project, replace every deployed secret, verify the replacement, and then revoke the legacy key. See [the migration guide](./docs/API_KEY_MIGRATION.md).
6
+
5
7
-**A simple-to-use, quick-to-deploy Python-based Telegram bot for OpenAI API & Perplexity API**
6
8
-**🎙 Transcribed Telegram voice messages via OpenAI speech-to-text models (Whisper and others)**
7
9
- Supports configurable STT models such as `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and legacy `whisper-1`
@@ -38,8 +40,35 @@
38
40
39
41
-**Telegram API bot token**
40
42
- use the [`@BotFather`](https://t.me/BotFather) bot on Telegram to set up your bot and get a Telegram Bot API token for it
41
-
-**OpenAI API token**
42
-
- Get one from from: https://platform.openai.com/
43
+
-**OpenAI project API key**
44
+
- Create it while the intended organization and project are selected: https://platform.openai.com/api-keys
45
+
- Store it as `OPENAI_API_KEY`; never commit it to Git
46
+
47
+
---
48
+
49
+
## Existing installations: do I need a new key?
50
+
51
+
**Yes**, when OpenAI has notified your organization that a key is a legacy user API key or it appears in the legacy **User API Keys** list. A key already created inside the intended project does not need replacement solely because of this deadline.
52
+
53
+
The request format remains:
54
+
55
+
```text
56
+
OPENAI_API_KEY=<project key>
57
+
Authorization: Bearer <project key>
58
+
```
59
+
60
+
ChatKeke v0.8.5 removes the mutable global `openai.api_key`. The credential is now resolved once at startup and passed explicitly into every raw HTTP request and OpenAI SDK client. Optional `OPENAI_ORG_ID` and `OPENAI_PROJECT_ID` overrides are supported, but a normal project key does not require them.
61
+
62
+
Current users must:
63
+
64
+
1. Select the correct OpenAI organization and project and create a new project key. For an unattended deployment, a project service-account key is preferable where available.
65
+
2. Replace `OPENAI_API_KEY` in every VPS/service environment, Docker secret or `.env`, GitHub Actions secret, staging deployment, and `config/api_token.txt` fallback still in use.
66
+
3. Restart or redeploy every instance.
67
+
4. Run `python3 scripts/verify_openai_key.py --live-request`.
68
+
5. Test normal chat, tool calls, and speech-to-text when enabled.
69
+
6. Revoke the legacy key only after every deployment passes.
70
+
71
+
Full instructions: [docs/API_KEY_MIGRATION.md](./docs/API_KEY_MIGRATION.md).
43
72
44
73
---
45
74
@@ -74,11 +103,18 @@
74
103
75
104
3.**Set up your Telegram bot token:**
76
105
77
-
- Either set your Telegram Bot API token as `TELEGRAM_BOT_TOKEN` environment variable, or put it into a text file named `bot_token.txt` inside the `config/` directory (= `config/bot_token.txt`)
106
+
- Either set your Telegram Bot API token as `TELEGRAM_BOT_TOKEN` environment variable, or put it into `config/bot_token.txt`.
107
+
- Token precedence is controlled by `PreferEnvForBotToken` in `config/config.ini`:
108
+
-`PreferEnvForBotToken = True`: use `TELEGRAM_BOT_TOKEN` first, then `config/bot_token.txt` if fallback is enabled.
109
+
-`PreferEnvForBotToken = False`: use `config/bot_token.txt` first, even when `TELEGRAM_BOT_TOKEN` is set. This is the manual/local override mode.
110
+
- To **never** fall back to the environment variable when using the file override, also set `AllowBotTokenFallback = False`.
111
+
- Existing installations should preserve their local `config/config.ini` when updating. Do not replace it wholesale with the repository default; use `src/configmerger.py` or merge the changed settings manually.
78
112
79
-
4.**Set up your OpenAI API token:**
113
+
4.**Set up your OpenAI project API key:**
80
114
81
-
- Either as `OPENAI_API_KEY` environment variable or put into a text file named `api_token.txt` inside the main program directory
115
+
- Recommended: set the project key as `OPENAI_API_KEY`
116
+
- Backwards-compatible fallback: place it in `config/api_token.txt` and run `chmod 600 config/api_token.txt`
117
+
- Startup logs only the credential source and a short one-way fingerprint, never the secret
82
118
83
119
5.**Other modules:**
84
120
@@ -103,9 +139,9 @@
103
139
1.**Docker** must be installed on your machine.
104
140
- If not installed, you can download and install it from [Docker's official site](https://www.docker.com/get-started).
105
141
106
-
2.**Telegram Bot API Key** and **OpenAI API Key**:
142
+
2.**Telegram Bot API Key** and **OpenAI project API key**:
107
143
- You will need a valid Telegram Bot API key. You can get one by creating a bot with [BotFather](https://core.telegram.org/bots#botfather).
108
-
-You will also need an OpenAI API key. If you don't have one, you can generate it from the [OpenAI API page](https://beta.openai.com/signup/).
144
+
-Create an OpenAI project API keyfrom the [OpenAI API Keys page](https://platform.openai.com/api-keys). Do not use a legacy user key for a new deployment.
109
145
110
146
### **Step 1: Clone the Repository**
111
147
@@ -126,7 +162,15 @@ Run the script:
126
162
./docker_setup.sh
127
163
```
128
164
129
-
Follow the instructions provided by the script. It will ask for your OpenAI API key and Telegram Bot API key, validate them, and create a `.env` file with your credentials.
165
+
Follow the instructions provided by the script. It hides the OpenAI key while it is entered and writes `.env` with owner-only permissions.
166
+
167
+
Verify the replacement before revoking the old key:
The GitHub Actions deployment uses a repository secret named `OPENAI_API_KEY`. Updating a local `.env` does not update that secret.
130
174
131
175
### **Step 3: Build the Docker Image**
132
176
@@ -241,6 +285,21 @@ If you run into any issues, consult the logs or reach out on the repository's [I
241
285
242
286
# Changelog
243
287
288
+
> The current application version is stored in the repository-root `VERSION` file and loaded by the runtime from there. Update `VERSION` once for a release instead of duplicating the current version in source files.
289
+
290
+
- v0.8.5 - OpenAI project-key migration and explicit credential handling
291
+
- Removed the mutable process-global `openai.api_key` and passed one resolved credential object explicitly into raw HTTP requests and the OpenAI SDK client.
292
+
- Added optional `OPENAI_ORG_ID` and `OPENAI_PROJECT_ID` routing overrides without requiring them for normal project keys.
293
+
- Added `docs/API_KEY_MIGRATION.md` and a current-user migration section to this README.
294
+
- Added `scripts/verify_openai_key.py` for secret-safe project access and live Chat Completions checks.
- Hardened Docker setup and GitHub Actions secret passing.
297
+
- Preserved Telegram bot-token source precedence: `PreferEnvForBotToken = False` continues to force `config/bot_token.txt` ahead of `TELEGRAM_BOT_TOKEN`.
298
+
- Upgrade patch/overlay does not modify `config/config.ini`, so local token-selection overrides are not clobbered.
299
+
- Fixed the python-telegram-bot error handler to be async, preventing a secondary `NoneType`/`await` traceback when Telegram reports polling errors such as a `getUpdates` conflict.
300
+
- Added API credential and Telegram token-precedence regression tests.
301
+
- Centralized the application version in the repository-root `VERSION` file; runtime banners, `/about`, and the DuckDuckGo User-Agent now use that single source of truth.
302
+
244
303
- v0.8.4 - DuckDuckGo search reliability hotfix
245
304
- Added HTTPX connection retries for DuckDuckGo/web fetches: `httpx.AsyncHTTPTransport(retries=2)` provides up to three connection attempts before a request fails.
246
305
- Fixes intermittent `httpx.ConnectError` failures observed in live service operation, including failures whose underlying cause surfaced as `BrokenResourceError`.
0 commit comments