/v1 API and exposes
SGLang-native endpoints through provider passthrough. Hugging Face model IDs
with slashes work because GoModel splits provider-qualified selectors on the
first slash only.
Start SGLang first:
Configure
These examples assume GoModel runs in Docker and SGLang runs on the host. If
both run in the same Docker or Kubernetes network, use the SGLang service
name. If GoModel runs directly on the host, use
http://localhost:30000/v1.Run GoModel
Verify
GET /v1/models returns SGLang model IDs prefixed by provider name, for
example sglang/Qwen/Qwen2.5-0.5B-Instruct.
Multiple SGLang instances
Use suffixed environment variables to register more than one instance without YAML:sglang and sglang-test. The suffix is lowercased and
underscores become hyphens.
Native passthrough
Passthrough is enabled by default. Root-relative SGLang endpoints such as/generate are sent without the configured /v1 prefix:
v1/ segment for SGLang endpoints that include it, such as
/v1/rerank or /v1/tokenize:
SGLANG_API_KEY when configured.
Responses API mode
Some SGLang builds return HTTP 500 from/v1/responses when the request
includes function tools, which breaks clients such as Codex CLI. SGLang’s
/v1/chat/completions handles those tools, so GoModel can translate the
Responses request to chat completions and return a normal Responses reply.
SGLANG_API_MODE (or api_mode in config.yaml) picks the path:
The default fits most setups. Hosted tools such as
web_search_preview have
no chat equivalent: requests with only hosted tools stay on /v1/responses
under auto, and translated requests drop them. Set native if you need
hosted tools alongside function tools. previous_response_id works in every
mode, because GoModel replays the stored conversation itself.
Capability notes
- Chat completions, streaming, model listing, Responses, and embeddings use SGLang’s OpenAI-compatible API. Responses with function tools go through chat completions by default; see Responses API mode.
- Embeddings and model-specific features depend on the model loaded by SGLang.
- Native batch, file, and stored-response lifecycle interfaces are not yet exposed as typed GoModel provider capabilities; use passthrough where the installed SGLang version supports them.