Skip to content

OpenRouter + Moonshot Kimi K2.6 fails with "tokenization failed" on every request #5159

@madeleineostoja

Description

@madeleineostoja

What happened?

All requests through openrouter/moonshotai/kimi-k2.6 fail with a 400 from the provider, even on a bare invocation with no tools, skills, extensions, prompt templates, or context files. Direct curl to the same OpenRouter endpoint with the same model works fine, which suggests Pi is sending a payload shape Moonshot's tokenizer rejects.

   Error: 400 Provider returned error
   {"error":{"message":"Invalid request: tokenization failed","type":"invalid_request_error"}}

Steps to reproduce

Try with Pi, observe 400 error

pi --no-extensions --no-skills --no-context-files --no-prompt-templates --no-tools \
      --provider openrouter --model moonshotai/kimi-k2.6 \
      -p "ping"

Try with curl direct to openrouter, observe successful response

curl https://openrouter.ai/api/v1/chat/completions \
     -H "Authorization: Bearer $OPENROUTER_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{"model":"moonshotai/kimi-k2.6","messages":[{"role":"user","content":"ping"}]}'

Expected behavior

Kimi K2.6 via openrouter should work in Pi

Version

0.77.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinginprogressIssue is being worked on

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions