Issue evidence · AI API · ollama/ollama

OpenAI-compatible responses use chatcmpl-<rand.Intn(999)> as id: 1000 possible values, collisions break clients

GitHub issue: https://github.com/ollama/ollama/issues/18996

Reproduced

Ollama's OpenAI-compatible endpoints build the response id from rand.Intn(999), so ids collide within a few hundred requests.

What Badgr ran

Sent 200 chat completions (max_tokens 1) to a local Ollama 0.11.10 serving qwen2.5:0.5b on CPU, and read middleware/openai.go on Ollama's main branch.

What came back

  • 200 requests returned 178 distinct ids, with 20 ids repeated; the numeric part ranged from 9 to 997.
  • On main, middleware/openai.go still builds fmt.Sprintf("chatcmpl-%d", rand.Intn(999)) (line 482) and "cmpl-%d" (line 389).

The issue is marked closed on GitHub, but the code on main still has the 999-value id. A Badgr API route returning unique ids was not tested here. See litellm-46403 for the downstream effect.

Checked 2026-10-14 in Badgr’s local development environment.

← All issue evidence