App/complete returns HTTP 500 for every BYOK provider (GLM / DeepSeek / MiniMax) while the non-BYOK path stays healthy

Summary: With BYOK enabled, `POST /api/v1/copilot/app/complete` consistently returns `HTTP 500 Internal Server Error`, regardless of provider or model. The non-BYOK path is healthy. The Anna team has confirmed this is a platform-side bug and a fix is in progress — posting here so the context and fix updates live in one thread (as Jiao suggested by email).

Environment:

- Account: qingyu_ge@foxmail.com (user_id 368)

- App slug: anna-truman-director

- BYOK providers registered (all show “verified” in Settings → LLM):

  • DeepSeek — official endpoint `api.deepseek.com/v1`

  • GLM — Coding Plan endpoint `open.bigmodel.cn/api/coding/paas/v4` (the standard `/api/paas/v4` has no balance for this key)

  • MiniMax — `api.minimaxi.com/v1`

- “Apps / plugins may use my API key” switch: ON

Reproduction (dev session, kind=complete):

1. `POST /api/v1/anna-apps/dev/session/mint` → **200 OK** (token carries quota caps: 4096 tok/call, 1000 calls/day)

2. `POST /api/v1/copilot/app/complete` with a minimal body (`Say OK`, max_tokens 32) → **HTTP 500 `Internal Server Error`** (plain text, no JSON detail)

Test matrix:

| Preferred model | Switch | Result |

|—|—|—|

| byok:glm/glm-5.3 (reasoning model) | ON | 500 |

| byok:minimax/MiniMax-M3 (reasoning model) | ON | 500 |

| byok:deepseek/deepseek-v4-flash (non-reasoning) | ON | 500 |

| Qwen3.7 Max (platform model) | OFF | normal 429 subscription JSON (code -32015) — non-BYOK path healthy |

Additional isolation:

- Each provider key tested directly against its own endpoint returns **200 OK** with correct completions — provider configs are clean

- Direct key test details: GLM coding endpoint returns proper completions incl. `reasoning_content`; provider “Test & Save” verification passes for all three

- Failure is isolated to the platform’s BYOK forwarding on app/complete, independent of provider and reasoning vs non-reasoning models

Impact: Blocks real-LLM end-to-end verification for apps whose developer quota is expired (the BYOK path is the recommended route for builders per the team).

Happy to add more details or re-test against a fix. Thanks!

Hi @gqy! :waving_hand:

First of all — thank you for this outstanding bug report! :raising_hands: The clean test matrix (three providers × reasoning/non-reasoning models, plus the direct-key isolation tests) made this a joy to investigate and let us reproduce it right away.

Confirmed & fixed! :white_check_mark:

Your diagnosis was spot on: this was a platform-side bug in the BYOK routing path for app/complete. It affected every BYOK provider and model equally — nothing was wrong with your provider configs, keys, or app. The non-BYOK path was untouched, which is exactly the asymmetry you observed.

What we did:

  • :wrench: Fixed the faulty code path in the BYOK model-selection step
  • :test_tube: Added a full end-to-end regression test covering the third-party BYOK chain, so this specific failure mode can’t sneak back in

Rollout: the fix ships in v1.1.0-beta.144, scheduled to roll out this Friday. :rocket:

Once it’s live, your exact repro (dev session mint → app/complete with byok:glm/glm-5.3, byok:minimax/MiniMax-M3, or byok:deepseek/deepseek-v4-flash) should return normal completions — reasoning models included. We’d love it if you could re-run your test matrix after the update and confirm on this thread! :green_heart:

Thanks again for taking the time to document this so thoroughly — reports like yours make the platform better for every builder. Happy building! :sparkles: