Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
162 lines
5.2 KiB
Markdown
162 lines
5.2 KiB
Markdown
---
|
|
summary: "Run OpenClaw with SGLang (OpenAI-compatible self-hosted server)"
|
|
read_when:
|
|
- You want to run OpenClaw against a local SGLang server
|
|
- You want OpenAI-compatible /v1 endpoints with your own models
|
|
title: "SGLang"
|
|
---
|
|
|
|
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.
|
|
|
|
| Property | Value |
|
|
| ------------------------- | ------------------------------------------------------------ |
|
|
| Provider id | `sglang` |
|
|
| Plugin | bundled, `enabledByDefault: true` |
|
|
| Auth env var | `SGLANG_API_KEY` (any non-empty value if server has no auth) |
|
|
| Onboarding flag | `--auth-choice sglang` |
|
|
| API | OpenAI-compatible (`openai-completions`) |
|
|
| Default base URL | `http://127.0.0.1:30000/v1` |
|
|
| Default model placeholder | `sglang/Qwen/Qwen3-8B` |
|
|
| Streaming usage | Yes (`supportsStreamingUsage: true`) |
|
|
| Pricing | Marked 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)](#model-discovery-implicit-provider) below.
|
|
|
|
## Getting started
|
|
|
|
<Steps>
|
|
<Step title="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`
|
|
|
|
</Step>
|
|
<Step title="Set an API key">
|
|
Any value works if no auth is configured on your server:
|
|
|
|
```bash
|
|
export SGLANG_API_KEY="sglang-local"
|
|
```
|
|
|
|
</Step>
|
|
<Step title="Run onboarding or set a model directly">
|
|
```bash
|
|
openclaw onboard
|
|
```
|
|
|
|
Or configure the model manually:
|
|
|
|
```json5
|
|
{
|
|
agents: {
|
|
defaults: {
|
|
model: { primary: "sglang/your-model-id" },
|
|
},
|
|
},
|
|
}
|
|
```
|
|
|
|
</Step>
|
|
</Steps>
|
|
|
|
## Model discovery (implicit provider)
|
|
|
|
When `SGLANG_API_KEY` is set (or an auth profile exists) and you **do not**
|
|
define `models.providers.sglang`, OpenClaw queries:
|
|
|
|
- `GET http://127.0.0.1:30000/v1/models`
|
|
|
|
and converts the returned IDs into model entries.
|
|
|
|
<Note>
|
|
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.
|
|
</Note>
|
|
|
|
## 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).
|
|
|
|
```json5
|
|
{
|
|
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
|
|
|
|
<AccordionGroup>
|
|
<Accordion title="Proxy-style behavior">
|
|
SGLang is treated as a proxy-style OpenAI-compatible `/v1` backend, not a
|
|
native OpenAI endpoint.
|
|
|
|
| Behavior | SGLang |
|
|
|----------|--------|
|
|
| OpenAI-only request shaping | Not applied |
|
|
| `service_tier`, Responses `store`, prompt-cache hints | Not sent |
|
|
| Reasoning-compat payload shaping | Not applied |
|
|
| Hidden attribution headers (`originator`, `version`, `User-Agent`) | Not injected on custom SGLang base URLs |
|
|
|
|
</Accordion>
|
|
|
|
<Accordion title="Troubleshooting">
|
|
**Server not reachable**
|
|
|
|
Verify the server is running and responding:
|
|
|
|
```bash
|
|
curl http://127.0.0.1:30000/v1/models
|
|
```
|
|
|
|
**Auth errors**
|
|
|
|
If 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`.
|
|
|
|
<Tip>
|
|
If you run SGLang without authentication, any non-empty value for
|
|
`SGLANG_API_KEY` is sufficient to opt in to model discovery.
|
|
</Tip>
|
|
|
|
</Accordion>
|
|
</AccordionGroup>
|
|
|
|
## Related
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="Model selection" href="/concepts/model-providers" icon="layers">
|
|
Choosing providers, model refs, and failover behavior.
|
|
</Card>
|
|
<Card title="Configuration reference" href="/gateway/configuration-reference" icon="gear">
|
|
Full config schema including provider entries.
|
|
</Card>
|
|
</CardGroup>
|