You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lightweight router for SGLang diffusion workers used in RL systems.
3
+
A lightweight router for SGLang diffusion workers used in RL systems. It provides worker registration, load balancing, health checking, refit weights and request proxying for diffusion generation APIs.
4
4
5
-
It provides worker registration, load balancing, health checking, refit weights and request proxying for diffusion generation APIs.
curl -X POST http://localhost:30081/v1/images/generations \
143
173
-H "Content-Type: application/json" \
144
174
-d '{
145
175
"model": "Qwen/Qwen-Image",
@@ -149,7 +179,7 @@ curl -X POST http://localhost:30081/generate \
149
179
}'
150
180
151
181
# Decode and save the image locally
152
-
curl -s -X POST http://localhost:30081/generate \
182
+
curl -s -X POST http://localhost:30081/v1/images/generations \
153
183
-H "Content-Type: application/json" \
154
184
-d '{
155
185
"model": "Qwen/Qwen-Image",
@@ -165,12 +195,71 @@ with open('output.png', 'wb') as f:
165
195
print('Saved to output.png')
166
196
"
167
197
198
+
# Video generation request
199
+
curl -X POST http://localhost:30081/v1/videos \
200
+
-H "Content-Type: application/json" \
201
+
-d '{"model": "Qwen/Qwen-Image", "prompt": "a flowing river"}'
202
+
203
+
# Poll a specific video job by video_id
204
+
curl http://localhost:30081/v1/videos/{video_id}
205
+
168
206
169
207
curl -X POST http://localhost:30081/update_weights_from_disk \
170
208
-H "Content-Type: application/json" \
171
209
-d '{"model_path": "Qwen/Qwen-Image-2512"}'
172
210
```
173
211
212
+
## Router API
213
+
214
+
### Inference Endpoints
215
+
216
+
| Method | Path | Description |
217
+
|---|---|---|
218
+
|`POST`|`/v1/images/generations`| Entrypoint for text-to-image generation |
219
+
|`POST`|`/v1/videos`| Entrypoint for text-to-video generation |
220
+
221
+
### Videos Result Query
222
+
223
+
| Method | Path | Description |
224
+
|---|---|---|
225
+
|`GET`|`/v1/videos`| List or poll video jobs |
226
+
|`GET`|`/v1/videos/{video_id}`| Get status/details of a single video job |
227
+
|`GET`|`/v1/videos/{video_id}/content`| Download generated video content |
228
+
229
+
Video query routing is stable by `video_id`: router caches `video_id -> worker` on create (`POST /v1/videos`), then forwards detail/content queries to the same worker. Unknown `video_id` returns `404`.
230
+
231
+
### Model Discovery and Health Checks
232
+
233
+
| Method | Path | Description |
234
+
|---|---|---|
235
+
|`GET`|`/v1/models`| OpenAI-style model discovery |
236
+
|`GET`|`/health`| Basic health probe |
237
+
238
+
`GET /v1/models` aggregates model lists from healthy workers and de-duplicates by model `id`.
239
+
240
+
### Worker Management APIs
241
+
242
+
| Method | Path | Description |
243
+
|---|---|---|
244
+
|`POST`|`/workers`| Register a worker |
245
+
|`GET`|`/workers`| List workers (including health/load) |
246
+
|`GET`|`/workers/{worker_id}`| Get worker details |
0 commit comments