If your backend integrates the ChatGPT, Claude, and Gemini APIs, the most common failure isn’t that the models are bad—it’s API key errors, network connectivity issues, or region-policy blocks. Midjourney doesn’t use the API-key system, but in Discord you’ll still run into permission and quota prompts—same thing at its core: you’re not “allowed.”
1-minute self-check: 90% of API errors are here
- Wrong key pasted: extra spaces or line breaks were copied, or you used a “project key” as a “personal key”
- Insufficient key permissions: billing not enabled / no card linked / your organization or project hasn’t been authorized for the corresponding model
- Environment variables not taking effect: did you restart the service? are the container and the host machine using two different configs?
- Proxy issues: being able to open webpages doesn’t mean your backend can directly reach the API domain—many people get stuck here
Treat the cause based on the error message
Shows Unauthorized or Invalid API key
Don’t rush to blame the platform. First regenerate the key in the console and revoke the old one; then check whether you’re using the correct field in the request headers. When building bots or plugins, some Koishi plugins often throw errors due to the key field name or paste format.
Shows Rate limit or Quota exceeded
This isn’t “broken”—you’re just using it too aggressively. Reduce concurrency and add retries with backoff; if you need stability, move to a plan with a higher quota. Same with Midjourney when fast hours run out—switch to slow queueing and don’t get worked up.


