THUDM / THUDM/slime

[Question] Is SlimeRouter + RadixTree intended to be strict TITO gateway?

Open
#1,633 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
8.5k
Forks
1.3k
Avg merge
5h 36m
Merged PRs (30d)
22

Description

Your Question

I’m trying to understand current SlimeRouter behavior in RadixTreeMiddleware + proxy path.
From the report, my understanding is:

Image

In middleware, /generate payload is rewritten:

request_json = await request.json()
request_json["input_tokens"] = input_tokens
request_json["stream"] = False
request._json = request_json

But in SlimeRouter.proxy, forwarding uses raw body bytes:

body = await request.body()

My question:
Is this intended (middleware rewrite is only for local cache logic, not for downstream forwarding)?
Or should worker actually receive rewritten /generate JSON (strict gateway/token-in behavior)?
If intended, should docs explicitly state this to avoid confusion around RadixTree “transparent token management”?
I may be misunderstanding the design, so would appreciate clarification from maintainers.

What I've Tried
  • I have search issues about this
Environment (if relevant)
Additional Context

No response

Pre-submission Checklist

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the RadixTreeMiddleware handling of /generate and the SlimeRouter.proxy entry point, comparing the rewritten request JSON with the raw body forwarded downstream. Check the linked documentation and FAQ context. Done means the intended gateway contract is established and, if needed, documented clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.