alfadb-bot
4e4cc80971
fix(openai-gateway): route APIKey accounts to /v1/chat/completions when upstream lacks Responses API
...
OpenAI APIKey accounts with base_url pointing to third-party OpenAI-compatible
upstreams (DeepSeek, Kimi, GLM, Qwen, etc.) were failing because the gateway
unconditionally converted Chat Completions requests to Responses format and
forwarded to {base_url}/v1/responses, which only exists on OpenAI's official
endpoint.
Detection-based routing:
- Probe upstream capability on account create/update via a minimal POST to
/v1/responses; HTTP 404/405 means 'unsupported', any other response means
'supported'.
- Persist result as accounts.extra.openai_responses_supported (bool).
- ForwardAsChatCompletions branches at function entry: APIKey accounts with
explicit support=false go through new forwardAsRawChatCompletions which
passthrough-forwards CC body to /v1/chat/completions without protocol
conversion.
Default behavior for accounts without the marker preserves the legacy
'always Responses' path — existing OpenAI APIKey accounts that were working
before this change continue to work without modification (the 'reality is
evidence' principle: an account that has been running implies upstream
capability).
Probe is fired async after Create / Update / BatchCreate; failures only log,
never block the admin flow. BulkUpdate omitted (low signal of base_url
changes; can be added if needed).
Implementation:
- New pkg internal/pkg/openai_compat: marker key + ShouldUseResponsesAPI
- New service file openai_apikey_responses_probe.go: probe + persist
- New service file openai_gateway_chat_completions_raw.go: CC pass-through
- Account test endpoint short-circuits with explicit message for
probed-unsupported accounts (full CC test path is a TODO)
Zero schema changes, zero migrations, zero frontend changes, zero wire
modifications — all wired through existing AccountTestService injection.
Closes: DeepSeek-OpenAI account (id=128) production failure
2026-04-30 19:25:45 +08:00
..
2026-03-23 03:49:28 +08:00
2026-04-25 14:52:58 +08:00
2026-04-19 18:45:04 +08:00
2026-03-31 13:24:22 +08:00
2026-04-23 21:40:58 +08:00
2026-04-23 21:40:58 +08:00
2026-04-14 16:26:46 +08:00
2026-04-14 16:26:46 +08:00
2026-04-05 17:11:01 +08:00
2026-04-25 14:52:58 +08:00
2026-04-28 04:53:29 +08:00
2026-04-25 16:56:50 +08:00
2026-04-30 19:25:45 +08:00
2026-04-15 15:29:52 +08:00
2026-04-25 05:26:33 +00:00
2026-04-14 09:32:11 +08:00
2026-04-01 02:19:42 +08:00
2026-04-25 14:52:58 +08:00
2026-04-22 00:54:38 +08:00
2026-04-22 13:19:28 +08:00
2026-04-27 17:32:34 +08:00
2026-04-14 09:15:49 +08:00
2026-04-22 00:54:38 +08:00
2026-04-22 00:54:38 +08:00
2026-04-23 16:34:37 +08:00
2026-04-23 16:34:37 +08:00
2026-04-23 16:34:37 +08:00
2026-04-05 17:11:01 +08:00
2026-04-23 16:34:37 +08:00
2026-04-09 18:14:28 +08:00
2026-04-23 16:34:37 +08:00
2026-04-29 21:27:52 +08:00
2026-04-25 20:22:07 +08:00
2026-04-26 12:42:35 +08:00
2026-04-21 09:53:15 -07:00
2026-04-21 09:53:15 -07:00
2026-04-21 09:53:15 -07:00
2026-04-04 14:32:26 +08:00
2026-04-04 14:32:26 +08:00
2026-03-27 14:33:05 +08:00
2026-04-04 14:32:26 +08:00
2026-03-27 20:11:24 +08:00
2026-03-27 20:18:07 +08:00
2026-04-01 02:19:42 +08:00
2026-04-01 12:24:52 +08:00
2026-03-25 19:03:12 +08:00
2026-03-25 17:38:41 +08:00
2026-03-27 14:33:05 +08:00
2026-04-05 17:21:36 +08:00
2026-03-25 19:03:12 +08:00
2026-03-23 03:49:28 +08:00
2026-04-23 16:34:37 +08:00
2026-04-23 16:34:37 +08:00
2026-04-23 16:34:37 +08:00
2026-03-19 22:27:55 +08:00
2026-03-19 22:27:55 +08:00
2026-03-19 22:27:55 +08:00
2026-04-22 14:57:47 +08:00
2026-04-25 08:44:18 +08:00
2026-04-26 12:42:35 +08:00
2026-04-21 09:53:15 -07:00
2026-04-22 14:56:56 +08:00
2026-04-22 14:56:56 +08:00
2026-04-25 08:44:18 +08:00
2026-04-25 08:44:18 +08:00
2026-04-26 12:42:35 +08:00
2026-04-25 08:44:18 +08:00
2026-04-26 12:42:35 +08:00
2026-04-14 09:36:40 +08:00
2026-04-14 09:36:26 +08:00
2026-04-14 09:31:45 +08:00
2026-04-14 09:35:20 +08:00
2026-04-23 16:34:37 +08:00
2026-04-23 16:34:37 +08:00
2026-04-23 16:34:37 +08:00
2026-04-27 16:47:44 +08:00
2026-04-17 22:06:32 +08:00
2026-04-17 22:06:32 +08:00
2026-04-20 22:01:41 +08:00
2026-04-17 22:06:32 +08:00
2026-04-23 17:28:01 +08:00
2026-04-23 00:45:10 +08:00
2026-04-23 00:45:10 +08:00
2026-04-20 23:38:59 +08:00
2026-04-20 20:21:02 +08:00
2026-04-21 14:14:49 +08:00
2026-04-21 14:14:49 +08:00
2026-04-22 19:17:08 +08:00
2026-04-22 20:08:31 +08:00
2026-04-22 20:08:31 +08:00
2026-04-22 19:17:08 +08:00
2026-04-20 20:21:02 +08:00
2026-04-21 14:39:19 +08:00
2026-04-21 14:39:19 +08:00
2026-04-21 14:14:49 +08:00
2026-04-20 20:21:02 +08:00
2026-04-23 00:45:10 +08:00
2026-04-23 00:45:10 +08:00
2026-04-23 00:45:10 +08:00
2026-04-14 09:20:39 +08:00
2026-04-23 00:45:10 +08:00
2026-04-25 20:39:58 -04:00
2026-04-29 16:53:09 +08:00
2026-04-23 21:40:58 +08:00
2026-04-14 17:35:27 +08:00
2026-03-23 03:49:28 +08:00
2026-04-30 13:38:22 +08:00
2026-04-14 10:18:39 +08:00
2026-04-23 21:40:58 +08:00
2026-03-27 14:33:05 +08:00
2026-04-23 21:40:58 +08:00
2026-04-24 23:16:32 +08:00
2026-04-25 20:39:58 -04:00
2026-04-24 23:16:32 +08:00
2026-04-08 16:11:19 +08:00
2026-04-08 16:23:02 +08:00
2026-04-30 13:38:22 +08:00
2026-04-04 11:25:01 +08:00
2026-04-04 11:25:01 +08:00
2026-03-26 11:17:25 +08:00
2026-03-24 09:32:34 +08:00
2026-04-29 16:53:09 +08:00
2026-03-24 09:32:34 +08:00
2026-04-29 16:53:09 +08:00
2026-04-23 21:40:58 +08:00
2026-04-24 23:16:32 +08:00
2026-04-23 21:40:58 +08:00
2026-04-25 22:50:35 +08:00
2026-04-14 09:23:02 +08:00
2026-04-19 18:05:25 +08:00
2026-04-19 18:05:25 +08:00
2026-04-05 17:11:01 +08:00
2026-04-17 22:06:32 +08:00
2026-04-30 13:38:22 +08:00
2026-04-29 15:44:54 +08:00
2026-04-24 23:16:32 +08:00
2026-04-24 23:16:32 +08:00
2026-04-14 09:36:40 +08:00
2026-04-14 17:35:27 +08:00
2026-04-01 00:45:56 +08:00
2026-04-29 16:53:09 +08:00
2026-04-23 21:40:58 +08:00
2026-03-24 09:32:01 +08:00
2026-03-24 09:32:01 +08:00
2026-04-29 16:53:09 +08:00
2026-03-24 09:31:32 +08:00
2026-04-23 16:34:37 +08:00
2026-03-30 11:43:07 +08:00
2026-03-27 14:33:05 +08:00
2026-03-19 16:56:18 +08:00
2026-04-24 23:16:32 +08:00
2026-03-27 20:11:24 +08:00
2026-04-23 00:45:10 +08:00
2026-04-22 12:30:08 +08:00
2026-04-14 09:36:40 +08:00
2026-04-14 09:35:20 +08:00
2026-03-30 16:23:38 +08:00
2026-03-30 16:44:15 +08:00
2026-04-23 12:58:13 +08:00
2026-04-25 14:52:58 +08:00
2026-04-25 14:52:58 +08:00
2026-04-25 14:52:58 +08:00
2026-04-25 14:52:58 +08:00
2026-04-30 19:25:45 +08:00
2026-04-04 11:25:01 +08:00
2026-04-09 12:29:49 +08:00
2026-04-29 21:46:19 +08:00
2026-04-29 21:46:19 +08:00
2026-04-25 14:52:58 +08:00
2026-04-25 14:52:58 +08:00
2026-04-25 14:52:58 +08:00
2026-04-09 12:29:49 +08:00
2026-03-29 20:52:29 +08:00
2026-03-24 19:20:15 +08:00
2026-04-20 22:01:41 +08:00
2026-04-02 00:11:17 +08:00
2026-04-02 01:03:22 +08:00
2026-04-11 22:48:45 +08:00
2026-04-28 11:15:09 +08:00
2026-04-28 11:15:09 +08:00
2026-04-23 12:58:13 +08:00
2026-04-30 19:25:45 +08:00
2026-04-28 11:15:09 +08:00
2026-04-30 19:25:45 +08:00
2026-04-28 11:15:09 +08:00
2026-04-28 11:15:09 +08:00
2026-04-01 00:46:38 +08:00
2026-04-28 10:55:29 +08:00
2026-04-29 21:46:19 +08:00
2026-04-23 16:30:43 +08:00
2026-04-28 04:53:29 +08:00
2026-04-23 21:40:58 +08:00
2026-04-09 12:29:28 +08:00
2026-04-09 12:29:28 +08:00
2026-04-25 14:52:58 +08:00
2026-04-25 14:52:58 +08:00
2026-04-25 05:26:33 +00:00
2026-04-05 17:11:01 +08:00
2026-03-30 00:21:51 +08:00
2026-04-05 17:21:36 +08:00
2026-04-27 00:39:06 +00:00
2026-03-23 00:10:22 +08:00
2026-04-02 20:44:28 +08:00
2026-04-05 17:11:01 +08:00
2026-04-05 17:11:01 +08:00
2026-04-24 19:31:49 +08:00
2026-04-24 19:31:49 +08:00
2026-04-25 14:52:58 +08:00
2026-04-30 12:02:08 +08:00
2026-04-30 12:02:08 +08:00
2026-04-30 12:02:08 +08:00
2026-04-28 11:15:09 +08:00
2026-04-15 15:29:52 +08:00
2026-04-28 11:15:09 +08:00
2026-03-20 18:22:00 +08:00
2026-04-29 15:01:02 +08:00
2026-04-29 15:01:02 +08:00
2026-04-14 17:35:27 +08:00
2026-04-14 17:35:27 +08:00
2026-03-21 23:30:13 +08:00
2026-03-21 23:30:13 +08:00
2026-04-22 12:30:08 +08:00
2026-04-09 17:49:02 +08:00
2026-04-29 15:01:02 +08:00
2026-04-14 17:35:27 +08:00
2026-03-21 23:49:50 +08:00
2026-03-21 23:30:13 +08:00
2026-03-18 16:22:19 +08:00
2026-04-15 01:27:24 +08:00
2026-04-22 13:18:10 +08:00
2026-04-22 13:18:10 +08:00
2026-04-14 09:36:26 +08:00
2026-04-14 17:35:27 +08:00
2026-04-22 14:57:16 +08:00
2026-04-22 14:57:16 +08:00
2026-04-21 23:20:37 +08:00
2026-04-21 23:20:37 +08:00
2026-04-23 19:22:43 +08:00
2026-04-22 10:26:22 +08:00
2026-04-26 12:42:35 +08:00
2026-04-11 13:16:35 +08:00
2026-04-22 11:28:58 +08:00
2026-04-22 18:01:51 +08:00
2026-04-22 18:01:51 +08:00
2026-04-21 13:35:54 +08:00
2026-04-21 13:35:54 +08:00
2026-04-22 12:30:17 +08:00
2026-04-22 11:17:23 +08:00
2026-04-21 13:35:54 +08:00
2026-04-21 13:35:54 +08:00
2026-04-22 12:30:17 +08:00
2026-04-22 12:30:17 +08:00
2026-04-22 14:57:16 +08:00
2026-04-22 12:30:17 +08:00
2026-04-25 08:44:18 +08:00
2026-04-11 13:16:35 +08:00
2026-04-22 16:38:36 +08:00
2026-04-22 02:32:53 +08:00
2026-04-21 12:50:55 +08:00
2026-04-23 21:40:58 +08:00
2026-04-23 21:40:58 +08:00
2026-04-23 12:58:13 +08:00
2026-04-23 12:58:13 +08:00
2026-04-23 12:58:13 +08:00
2026-04-24 11:32:41 +08:00
2026-04-23 21:40:58 +08:00
2026-04-03 01:50:26 +08:00
2026-04-29 22:48:39 +08:00
2026-04-29 22:48:39 +08:00
2026-04-29 22:48:39 +08:00
2026-04-21 20:36:10 +08:00
2026-04-22 16:51:23 +08:00
2026-04-22 12:30:07 +08:00
2026-04-21 00:05:17 +08:00
2026-04-22 13:18:10 +08:00
2026-04-30 13:38:22 +08:00
2026-04-30 13:38:22 +08:00
2026-04-21 10:13:28 -07:00
2026-04-23 21:40:58 +08:00
2026-04-04 11:13:58 +08:00
2026-03-27 14:33:05 +08:00
2026-04-05 17:11:01 +08:00
2026-03-30 00:21:51 +08:00
2026-04-05 17:11:01 +08:00
2026-04-05 17:11:01 +08:00
2026-04-05 17:11:01 +08:00
2026-04-20 19:53:22 +08:00
2026-04-16 01:53:22 +08:00
2026-04-17 22:07:15 +08:00
2026-04-14 09:36:26 +08:00
2026-04-04 11:09:01 +08:00
2026-04-14 09:22:12 +08:00
2026-04-23 16:34:37 +08:00
2026-04-23 16:34:37 +08:00
2026-04-21 01:00:59 +08:00
2026-04-22 14:57:47 +08:00
2026-04-22 19:11:51 +08:00
2026-04-23 16:34:37 +08:00
2026-04-25 20:39:58 -04:00
2026-04-29 16:53:09 +08:00
2026-04-14 09:36:40 +08:00
2026-04-14 17:35:27 +08:00
2026-04-27 16:47:44 +08:00