Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt

Use this file to discover all available pages before exploring further.

SGLang serves open-weight models via an OpenAI-compatible HTTP API. OpenClaw connects to SGLang using the openai-completions provider family with auto-discovery of available models.
PropertyValue
Provider idsglang
Pluginbundled, enabledByDefault: true
Auth env varSGLANG_API_KEY (any non-empty value if server has no auth)
Onboarding flag--auth-choice sglang
APIOpenAI-compatible (openai-completions)
Default base URLhttp://127.0.0.1:30000/v1
Default model placeholdersglang/Qwen/Qwen3-8B
Streaming usageYes (supportsStreamingUsage: true)
PricingMarked external-free (modelPricing.external: false)
OpenClaw also auto-discovers available models from SGLang when you opt in with SGLANG_API_KEY. Use sglang/* in agents.defaults.models to keep discovery dynamic when you also configure a custom SGLang base URL. See Model discovery (implicit provider) below.

Getting started

1

Start SGLang

Launch SGLang with an OpenAI-compatible server. Your base URL should expose /v1 endpoints (for example /v1/models, /v1/chat/completions). SGLang commonly runs on:
  • http://127.0.0.1:30000/v1
2

Set an API key

Any value works if no auth is configured on your server:
export SGLANG_API_KEY="sglang-local"
3

Run onboarding or set a model directly

openclaw onboard
Or configure the model manually:
{
  agents: {
    defaults: {
      model: { primary: "sglang/your-model-id" },
    },
  },
}

Model discovery (implicit provider)

When SGLANG_API_KEY is set (or an auth profile exists) and you do not define models.providers.sglang, OpenClaw will query:
  • GET http://127.0.0.1:30000/v1/models
and convert the returned IDs into model entries.
If you set models.providers.sglang explicitly, OpenClaw uses your declared models by default. Add "sglang/*": {} to agents.defaults.models when you want OpenClaw to query that configured provider’s /models endpoint and include all advertised SGLang models.

Explicit configuration (manual models)

Use explicit config when:
  • SGLang runs on a different host/port.
  • You want to pin contextWindow/maxTokens values.
  • Your server requires a real API key (or you want to control headers).
{
  models: {
    providers: {
      sglang: {
        baseUrl: "http://127.0.0.1:30000/v1",
        apiKey: "${SGLANG_API_KEY}",
        api: "openai-completions",
        models: [
          {
            id: "your-model-id",
            name: "Local SGLang Model",
            reasoning: false,
            input: ["text"],
            cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
            contextWindow: 128000,
            maxTokens: 8192,
          },
        ],
      },
    },
  },
}

Advanced configuration

SGLang is treated as a proxy-style OpenAI-compatible /v1 backend, not a native OpenAI endpoint.
BehaviorSGLang
OpenAI-only request shapingNot applied
service_tier, Responses store, prompt-cache hintsNot sent
Reasoning-compat payload shapingNot applied
Hidden attribution headers (originator, version, User-Agent)Not injected on custom SGLang base URLs
Server not reachableVerify the server is running and responding:
curl http://127.0.0.1:30000/v1/models
Auth errorsIf requests fail with auth errors, set a real SGLANG_API_KEY that matches your server configuration, or configure the provider explicitly under models.providers.sglang.
If you run SGLang without authentication, any non-empty value for SGLANG_API_KEY is sufficient to opt in to model discovery.

Model selection

Choosing providers, model refs, and failover behavior.

Configuration reference

Full config schema including provider entries.