Skip to content

Model alias is case-sensitive and causes 400 for lowercase Kimi model name #4

Description

@andrey055

Summary

OpenGNK forwards the model field to the upstream Gonka API without normalizing known model aliases.

As a result, requests using the lowercase model name:

{
  "model": "moonshotai/kimi-k2.6"
}

fail with HTTP 400, even though the intended model exists as:

{
  "model": "moonshotai/Kimi-K2.6"
}

This is inconvenient for OpenAI-compatible clients or gateways that may normalize model identifiers to lowercase.

Environment

  • Repository: gonkalabs/opengnk
  • Endpoint: /v1/chat/completions
  • Mode: streaming request
  • Upstream: https://node4.gonka.ai

Error

time=2026-05-14T06:28:52.307Z level=INFO msg="upstream stream request" method=POST url=https://node4.gonka.ai/v1/chat/completions endpoint_addr=gonka1y2a9p56kv044327uycmqdexl7zs82fs5ryv5le wallet=gonka1m5ncrzrjks9utrz98fjdlak8n6gslnz30rfu62

time=2026-05-14T06:28:52.418Z level=ERROR msg="upstream stream status" code=400 body="{\"error\":{\"message\":\"unsupported model \\\"moonshotai/kimi-k2.6\\\"; supported models: moonshotai/Kimi-K2.6, Qwen/Qwen3-235B-A22B-Instruct-2507-FP8\"}}\n"

Steps to reproduce

Send a request with lowercase Kimi model name:

curl -s http://localhost:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "moonshotai/kimi-k2.6",
    "messages": [
      {
        "role": "user",
        "content": "hi"
      }
    ],
    "max_tokens": 20,
    "stream": true
  }'

Actual behavior

OpenGNK forwards the model name as-is to the upstream API.

The upstream API returns:

{
  "error": {
    "message": "unsupported model \"moonshotai/kimi-k2.6\"; supported models: moonshotai/Kimi-K2.6, Qwen/Qwen3-235B-A22B-Instruct-2507-FP8"
  }
}

Expected behavior

OpenGNK should normalize known model aliases before forwarding the request upstream.

For example:

moonshotai/kimi-k2.6 -> moonshotai/Kimi-K2.6
qwen/qwen3-235b-a22b-instruct-2507-fp8 -> Qwen/Qwen3-235B-A22B-Instruct-2507-FP8

Suggested fix

Add model alias normalization in internal/api/handler.go, inside chatCompletions, after reading/sanitizing the request body and before forwarding it to streamResponse, nonStreamResponse, or tool simulation logic.

This would make the proxy more compatible with OpenAI-style clients and gateways that may lowercase model identifiers.

Impact

  • Some OpenAI-compatible clients fail when using lowercase model identifiers.
  • Users receive a 400 error even though the model exists and is available.
  • The issue affects compatibility rather than core inference functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions