Skip to content

Commit 51a86ce

Browse files
authored
[model-gateway] change rust package name to sgl-model-gateway instead (#14283)
1 parent 64092c8 commit 51a86ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+168
-161
lines changed

sgl-router/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "sglang-router"
2+
name = "sgl-model-gateway"
33
version = "0.2.3"
44
edition = "2021"
55

@@ -11,12 +11,11 @@ vendored-openssl = ["openssl/vendored"]
1111
unused_qualifications = "warn"
1212

1313
[lib]
14-
name = "sglang_router_rs"
15-
# Pure Rust library (rlib for the binary and other Rust dependents)
14+
name = "sgl_model_gateway"
1615
crate-type = ["rlib"]
1716

1817
[[bin]]
19-
name = "sglang-router"
18+
name = "sgl-model-gateway"
2019
path = "src/main.rs"
2120

2221
[[bin]]

sgl-router/README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,28 @@ pip install --force-reinstall dist/*.whl
9393
After installation, verify the installation and check version information:
9494

9595
```bash
96-
# Short version info (Rust binary)
97-
./target/release/sglang-router -v
98-
99-
# Full version info with build details (Rust binary)
100-
./target/release/sglang-router --version
96+
# Simple version (Rust binary)
97+
./target/release/sgl-model-gateway --version
98+
# or use aliases
99+
./target/release/smg --version
100+
./target/release/amg --version
101+
102+
# Full version info with build details
103+
./target/release/sgl-model-gateway --version-verbose
104+
105+
# Python CLI
106+
amg --version
107+
amg --version-verbose
108+
python3 -m sglang_router --version
101109
```
102110

103-
The `-v` flag displays a concise version string, while `--version` (or `-V`) shows comprehensive build information including Git commit, build time, compiler versions, and platform details.
111+
The `--version` (or `-V`) flag displays the version string. Use `--version-verbose` for comprehensive build information including Git commit, build time, compiler versions, and platform details.
104112

105113
## Quick Start
106114
### Regular HTTP Routing
107115
- **Rust binary**
108116
```bash
109-
./target/release/sglang-router \
117+
./target/release/sgl-model-gateway \
110118
--worker-urls http://worker1:8000 http://worker2:8000 \
111119
--policy cache_aware
112120
```
@@ -121,7 +129,7 @@ The `-v` flag displays a concise version string, while `--version` (or `-V`) sho
121129
### Prefill/Decode Disaggregation (PD)
122130
- **Rust binary**
123131
```bash
124-
./target/release/sglang-router \
132+
./target/release/sgl-model-gateway \
125133
--pd-disaggregation \
126134
--prefill http://prefill1:30001 9001 \
127135
--prefill http://prefill2:30002 \
@@ -146,7 +154,7 @@ Prefill entries accept an optional bootstrap port. PD mode merges prefill metada
146154
### Multi-Model Inference Gateway
147155
Enable IGW mode to route multiple models through a single router while applying per-model policies:
148156
```bash
149-
./target/release/sglang-router \
157+
./target/release/sgl-model-gateway \
150158
--enable-igw \
151159
--policy cache_aware \
152160
--max-concurrent-requests 512
@@ -194,7 +202,7 @@ Add more workers with the same API; include optional `labels` (for per-model pol
194202
### gRPC Routing
195203
- **Rust binary**
196204
```bash
197-
./target/release/sglang-router \
205+
./target/release/sgl-model-gateway \
198206
--worker-urls grpc://worker-grpc-0:31001 grpc://worker-grpc-1:31002 \
199207
--tokenizer-path /path/to/tokenizer.json \
200208
--reasoning-parser deepseek-r1 \
@@ -229,15 +237,15 @@ python3 -m sglang_router.launch_router \
229237
**Notes**
230238
- OpenAI backend mode acts as a proxy to a single remote endpoint; load balancing is not applied.
231239
- Provide exactly one `--worker-urls` entry per router instance.
232-
- The Rust binary supports the same flags (`./target/release/sglang-router --backend openai ...`).
240+
- The Rust binary supports the same flags (`./target/release/sgl-model-gateway --backend openai ...`).
233241

234242
### MCP Integration
235243
The SGL Model Gateway provides native Model Context Protocol (MCP) client integration, enabling tool calling across STDIO, SSE, and Streamable transports. MCP servers are configured via a YAML configuration file and registered at startup through the workflow engine.
236244

237245
#### Basic Usage
238246
```bash
239247
# Rust binary
240-
./target/release/sglang-router \
248+
./target/release/sgl-model-gateway \
241249
--mcp-config-path /path/to/mcp-config.yaml \
242250
--worker-urls http://worker1:8000
243251

@@ -407,7 +415,7 @@ All administrative routes inherit router API-key protection when `--api-key` is
407415
### Service Discovery
408416
Enable Kubernetes discovery to reconcile workers automatically:
409417
```bash
410-
./target/release/sglang-router \
418+
./target/release/sgl-model-gateway \
411419
--service-discovery \
412420
--selector app=sglang-worker role=inference \
413421
--service-discovery-namespace sglang-system \

sgl-router/benches/request_processing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::time::Instant;
22

33
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, Throughput};
44
use serde_json::{from_str, to_string, to_value, to_vec};
5-
use sglang_router_rs::{
5+
use sgl_model_gateway::{
66
core::{BasicWorker, BasicWorkerBuilder, Worker, WorkerType},
77
protocols::{
88
chat::{ChatCompletionRequest, ChatMessage, MessageContent},

sgl-router/benches/tokenizer_benchmark.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::{
1313
};
1414

1515
use criterion::{black_box, criterion_group, BenchmarkId, Criterion, Throughput};
16-
use sglang_router_rs::tokenizer::{
16+
use sgl_model_gateway::tokenizer::{
1717
cache::{CacheConfig, CachedTokenizer},
1818
huggingface::HuggingFaceTokenizer,
1919
sequence::Sequence,
@@ -31,7 +31,7 @@ fn get_tokenizer_path() -> &'static PathBuf {
3131
// with special: true, normalized: false - perfect for demonstrating L1 cache
3232
let rt = tokio::runtime::Runtime::new().expect("Failed to create tokio runtime");
3333
let tokenizer_dir = rt.block_on(async {
34-
sglang_router_rs::tokenizer::hub::download_tokenizer_from_hf(
34+
sgl_model_gateway::tokenizer::hub::download_tokenizer_from_hf(
3535
"Qwen/Qwen3-4B-Instruct-2507",
3636
)
3737
.await

sgl-router/benches/tool_parser_benchmark.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::{
1919

2020
use criterion::{black_box, criterion_group, BenchmarkId, Criterion, Throughput};
2121
use serde_json::json;
22-
use sglang_router_rs::{
22+
use sgl_model_gateway::{
2323
protocols::common::{Function, Tool},
2424
tool_parser::{JsonParser, ParserFactory as ToolParserFactory, ToolParser},
2525
};

sgl-router/bindings/golang/Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[package]
2-
name = "sglang-router-golang"
3-
version = "0.2.2"
2+
name = "sgl-model-gateway-golang"
3+
version = "0.2.3"
44
edition = "2021"
55

66
[lib]
7-
name = "sglang_router_rs"
7+
name = "sgl_model_gateway_go"
88
crate-type = ["cdylib"]
99

1010
[dependencies]
@@ -18,14 +18,13 @@ once_cell = "1.21.3"
1818
futures-util = "0.3"
1919
tracing = "0.1"
2020

21-
[dependencies.sglang-router]
21+
[dependencies.sgl-model-gateway]
2222
path = "../.."
2323
default-features = true
24-
package = "sglang-router"
2524

2625
[features]
2726
default = []
28-
vendored-openssl = ["sglang-router/vendored-openssl"]
27+
vendored-openssl = ["sgl-model-gateway/vendored-openssl"]
2928

3029
[profile.release]
3130
opt-level = "z" # Optimize for size

sgl-router/bindings/golang/src/client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ use tokio::runtime::Runtime;
88
use once_cell::sync::Lazy;
99
use uuid::Uuid;
1010

11-
use sglang_router::tokenizer::create_tokenizer_from_file;
12-
use sglang_router::tokenizer::traits::Tokenizer;
13-
use sglang_router::grpc_client::sglang_scheduler::SglangSchedulerClient;
14-
use sglang_router::protocols::chat::ChatCompletionRequest;
15-
use sglang_router::routers::grpc::utils::{process_chat_messages, generate_tool_constraints};
11+
use sgl_model_gateway::tokenizer::create_tokenizer_from_file;
12+
use sgl_model_gateway::tokenizer::traits::Tokenizer;
13+
use sgl_model_gateway::grpc_client::sglang_scheduler::SglangSchedulerClient;
14+
use sgl_model_gateway::protocols::chat::ChatCompletionRequest;
15+
use sgl_model_gateway::routers::grpc::utils::{process_chat_messages, generate_tool_constraints};
1616

1717
use super::error::{SglErrorCode, set_error_message};
1818
use super::grpc_converter::sgl_grpc_response_converter_create;

sgl-router/bindings/golang/src/grpc_converter.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ use serde_json::Value;
99
use tokio::runtime::Runtime;
1010
use once_cell::sync::Lazy;
1111

12-
use sglang_router::tokenizer::traits::Tokenizer;
13-
use sglang_router::tokenizer::stream::DecodeStream;
14-
use sglang_router::tool_parser::ToolParser;
15-
use sglang_router::protocols::common::{Tool, ToolChoice, ToolChoiceValue, ToolCallDelta, FunctionCallDelta, Usage, StringOrArray};
16-
use sglang_router::tokenizer::stop::StopSequenceDecoder;
17-
use sglang_router::grpc_client::sglang_proto as proto;
12+
use sgl_model_gateway::tokenizer::traits::Tokenizer;
13+
use sgl_model_gateway::tokenizer::stream::DecodeStream;
14+
use sgl_model_gateway::tool_parser::ToolParser;
15+
use sgl_model_gateway::protocols::common::{Tool, ToolChoice, ToolChoiceValue, ToolCallDelta, FunctionCallDelta, Usage, StringOrArray};
16+
use sgl_model_gateway::tokenizer::stop::StopSequenceDecoder;
17+
use sgl_model_gateway::grpc_client::sglang_proto as proto;
1818

1919
use super::error::{SglErrorCode, set_error_message, clear_error_message};
2020
use super::tokenizer::TokenizerHandle;
2121
use super::utils::generate_tool_call_id;
2222

2323
/// Global parser factory (initialized once)
2424
// Use the re-exported ParserFactory from tool_parser module
25-
static PARSER_FACTORY: Lazy<sglang_router::tool_parser::ParserFactory> = Lazy::new(|| {
25+
static PARSER_FACTORY: Lazy<sgl_model_gateway::tool_parser::ParserFactory> = Lazy::new(|| {
2626
// ParserFactory is re-exported from tool_parser::factory, so we can use it directly
27-
sglang_router::tool_parser::ParserFactory::default()
27+
sgl_model_gateway::tool_parser::ParserFactory::default()
2828
});
2929

3030
/// Global tokio runtime for async operations
@@ -151,7 +151,7 @@ pub unsafe extern "C" fn sgl_grpc_response_converter_create(
151151
// Create stop decoder if needed
152152
let stop_decoder = if stop.is_some() || stop_token_ids.is_some() {
153153
Some(Arc::new(tokio::sync::Mutex::new(
154-
sglang_router::routers::grpc::utils::create_stop_decoder(
154+
sgl_model_gateway::routers::grpc::utils::create_stop_decoder(
155155
&tokenizer,
156156
stop.as_ref(),
157157
stop_token_ids.as_ref(),
@@ -389,9 +389,9 @@ pub(crate) async fn convert_proto_chunk_to_openai(
389389
request_id: &str,
390390
created: u64,
391391
system_fingerprint: Option<&str>,
392-
) -> Result<Option<sglang_router::protocols::chat::ChatCompletionStreamResponse>, String> {
393-
use sglang_router::grpc_client::sglang_proto::generate_response::Response::*;
394-
use sglang_router::protocols::chat::{ChatCompletionStreamResponse, ChatMessageDelta, ChatStreamChoice};
392+
) -> Result<Option<sgl_model_gateway::protocols::chat::ChatCompletionStreamResponse>, String> {
393+
use sgl_model_gateway::grpc_client::sglang_proto::generate_response::Response::*;
394+
use sgl_model_gateway::protocols::chat::{ChatCompletionStreamResponse, ChatMessageDelta, ChatStreamChoice};
395395

396396
match proto_response.response {
397397
Some(Chunk(chunk)) => {
@@ -427,19 +427,19 @@ pub(crate) async fn convert_proto_chunk_to_openai(
427427
let mut text = String::new();
428428
for &token_id in &chunk.token_ids {
429429
match decoder_guard.process_token(token_id).unwrap_or_else(|_| {
430-
sglang_router::tokenizer::stop::SequenceDecoderOutput::Held
430+
sgl_model_gateway::tokenizer::stop::SequenceDecoderOutput::Held
431431
}) {
432-
sglang_router::tokenizer::stop::SequenceDecoderOutput::Text(t) => {
432+
sgl_model_gateway::tokenizer::stop::SequenceDecoderOutput::Text(t) => {
433433
text.push_str(&t);
434434
}
435-
sglang_router::tokenizer::stop::SequenceDecoderOutput::StoppedWithText(t) => {
435+
sgl_model_gateway::tokenizer::stop::SequenceDecoderOutput::StoppedWithText(t) => {
436436
text.push_str(&t);
437437
break;
438438
}
439-
sglang_router::tokenizer::stop::SequenceDecoderOutput::Stopped => {
439+
sgl_model_gateway::tokenizer::stop::SequenceDecoderOutput::Stopped => {
440440
break;
441441
}
442-
sglang_router::tokenizer::stop::SequenceDecoderOutput::Held => {}
442+
sgl_model_gateway::tokenizer::stop::SequenceDecoderOutput::Held => {}
443443
}
444444
}
445445
text

sgl-router/bindings/golang/src/stream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use tokio::runtime::Runtime;
2323
use once_cell::sync::Lazy;
2424
use futures_util::StreamExt;
2525

26-
use sglang_router::grpc_client::{sglang_proto as proto, sglang_scheduler::{SglangSchedulerClient, AbortOnDropStream}};
26+
use sgl_model_gateway::grpc_client::{sglang_proto as proto, sglang_scheduler::{SglangSchedulerClient, AbortOnDropStream}};
2727

2828
use super::error::{SglErrorCode, set_error_message};
2929
use super::grpc_converter::{GrpcResponseConverterHandle, convert_proto_chunk_to_openai};

sgl-router/bindings/golang/src/tokenizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::ptr;
66
use std::sync::Arc;
77
use serde_json::Value;
88

9-
use sglang_router::tokenizer::{
9+
use sgl_model_gateway::tokenizer::{
1010
create_tokenizer_from_file,
1111
traits::Tokenizer as TokenizerTrait,
1212
chat_template::ChatTemplateParams,

0 commit comments

Comments
 (0)