#6642·ogx

[RFE] Add SGLang inference provider (remote::sglang)

Author: mattfCreated Sep 23, 2026Updated Sep 23, 2026
Labelsenhancementapi provider

Background

SGLang is a widely used open-source LLM serving engine (fast, OpenAI-compatible, with native tool-calling, structured output, and reasoning-model support). OGX currently ships first-class providers for vLLM (remote::vllm) and Ollama as self-hosted backends, but users running SGLang must work around it — e.g. pointing the generic OpenAI provider at an SGLang endpoint, which loses provider-specific behavior (health checks, model-type classification, rerank, reasoning handling) and ogx stack lets-go autodetection.

Request

Add a first-class remote::sglang inference provider, mirroring the existing remote::vllm implementation, which covers SGLang's OpenAI-compatible surface plus its extensions.

Proposed scope

  • src/ogx/providers/remote/inference/sglang/ package:
    • SGlangInferenceAdapterConfig — base_url (default port 30000), max_tokens, api_token, network/TLS config; env-var driven (SGLANG_URL, SGLANG_API_TOKEN)
    • SGlangInferenceAdapter(OpenAIMixin):
      • Chat completions (streaming + non-streaming) with tool calling
      • Embeddings + GET /v1/models listing with embedding/rerank model classification (models.dev)
      • GET /health provider health check
      • Rerank via SGLang's Jina-compatible endpoint
      • Reasoning-model support (streaming reasoning_content handling)
      • Anthropic Messages API passthrough (/v1/messages) where the SGLang version supports it
  • Registration in the inference provider registry (remote::sglang)
  • ci-tests distribution wiring (env-gated on SGLANG_URL) + provider docs
  • ogx stack lets-go autodetection for a local SGLang server
  • Unit tests + integration test setup with recorded fixtures

Usage

yaml
providers:
  - provider_id: sglang
    provider_type: remote::sglang
    config:
      base_url: http://localhost:30000/v1
      max_tokens: 4096
      api_token: ${env.SGLANG_API_TOKEN:=fake}

Justification

SGLang is one of the most common self-hosted serving runtimes (especially for Qwen/DeepSeek reasoning models and high-throughput deployments). First-class support removes a workaround, gets SGLang users the full OGX API surface (Responses, Anthropic Messages, rerank, tool runtime) out of the box, and makes local-model onboarding consistent with vLLM/Ollama.

Non-goals (for now)

  • Starter-distribution inclusion (can be a follow-up once the provider matures)

Prior art

remote::vllm provider (src/ogx/providers/remote/inference/vllm/) — SGLang's server API is largely OpenAI-compatible with a similar extension surface, so the implementation is expected to closely follow it.