Every host below is reachable through
provider/openaicompat with one constructor
and no skyl code. Four of them run on your own machine.
The endpoints#
| Host | Base URL | Key? | Notes |
|---|---|---|---|
| xAI (Grok) | https://api.x.ai/v1 | Required | |
| DeepSeek | https://api.deepseek.com/v1 | Required | |
| Mistral | https://api.mistral.ai/v1 | Required | |
| Groq | https://api.groq.com/openai/v1 | Required | |
| Together | https://api.together.xyz/v1 | Required | |
| Fireworks | https://api.fireworks.ai/inference/v1 | Required | |
| OpenRouter | https://openrouter.ai/api/v1 | Required | Brokers 300+ models on its own, and supplies DisplayName and ContextWindow on model listing. |
| Perplexity | https://api.perplexity.ai | Required | |
| Cerebras | https://api.cerebras.ai/v1 | Required | |
| DeepInfra | https://api.deepinfra.com/v1/openai | Required | |
| Qwen / DashScope | https://dashscope.aliyuncs.com/compatible-mode/v1 | Required | |
| Moonshot (Kimi) | https://api.moonshot.cn/v1 | Required | |
| Z.ai (GLM) | https://open.bigmodel.cn/api/paas/v4 | Required | |
| Nvidia NIM | https://integrate.api.nvidia.com/v1 | Required | |
| Ollama | http://localhost:11434/v1 | None | Local. Needs no credential — omit WithAPIKey entirely. |
| vLLM | http://localhost:8000/v1 | None | Self-hosted. Returns content as an array of blocks on some builds, which skyl handles. |
| LM Studio | http://localhost:1234/v1 | None | Local. |
| llama.cpp | http://localhost:8080/v1 | None | Local. |
Caveats
- These implement OpenAI's format, not necessarily its features. Tool calling, streaming and multimodal support vary by host and by model.
- The four with no key are local runtimes. Omit
WithAPIKeyentirely rather than passing an empty string. - Base URLs change. If one stops working, check the vendor's documentation — skyl does not validate them, so a wrong URL surfaces as that host's own error.
- Always set
WithName, or every host reports the same label.
Usage#
Any hosted endpoint
p := openaicompat.New(
openaicompat.WithBaseURL("https://api.deepseek.com/v1"),
openaicompat.WithAPIKey(os.Getenv("DEEPSEEK_API_KEY")),
openaicompat.WithName("deepseek"),
)p := openaicompat.New(
openaicompat.WithBaseURL("https://api.deepseek.com/v1"),
openaicompat.WithAPIKey(os.Getenv("DEEPSEEK_API_KEY")),
openaicompat.WithName("deepseek"),
)A registry of hosts
type host struct {
name string
baseURL string
envKey string // empty for local runtimes
}
var hosts = []host{
{"groq", "https://api.groq.com/openai/v1", "GROQ_API_KEY"},
{"deepseek", "https://api.deepseek.com/v1", "DEEPSEEK_API_KEY"},
{"ollama", "http://localhost:11434/v1", ""},
}
func build(h host) skyl.Provider {
opts := []openaicompat.Option{
openaicompat.WithBaseURL(h.baseURL),
openaicompat.WithName(h.name),
}
if h.envKey != "" {
opts = append(opts, openaicompat.WithAPIKey(os.Getenv(h.envKey)))
}
return openaicompat.New(opts...)
}type host struct {
name string
baseURL string
envKey string // empty for local runtimes
}
var hosts = []host{
{"groq", "https://api.groq.com/openai/v1", "GROQ_API_KEY"},
{"deepseek", "https://api.deepseek.com/v1", "DEEPSEEK_API_KEY"},
{"ollama", "http://localhost:11434/v1", ""},
}
func build(h host) skyl.Provider {
opts := []openaicompat.Option{
openaicompat.WithBaseURL(h.baseURL),
openaicompat.WithName(h.name),
}
if h.envKey != "" {
opts = append(opts, openaicompat.WithAPIKey(os.Getenv(h.envKey)))
}
return openaicompat.New(opts...)
}Discovering what a host offers
// The answer comes from the host, live — so it is never stale, and it is the
// only reliable way to know what a compatible endpoint actually serves.
models, err := client.Models(ctx)
if err != nil {
return err
}
for _, m := range models {
fmt.Println(m.ID)
}// The answer comes from the host, live — so it is never stale, and it is the
// only reliable way to know what a compatible endpoint actually serves.
models, err := client.Models(ctx)
if err != nil {
return err
}
for _, m := range models {
fmt.Println(m.ID)
}Local runtimes#
Ollama, vLLM, LM Studio and llama.cpp all run on your own hardware and authenticate nothing. This is the case that makes "develop against a local model, deploy against a frontier one" a configuration change rather than two code paths.
func local() skyl.Provider {
return openaicompat.New(
openaicompat.WithBaseURL("http://localhost:11434/v1"),
openaicompat.WithName("ollama"),
)
}func local() skyl.Provider {
return openaicompat.New(
openaicompat.WithBaseURL("http://localhost:11434/v1"),
openaicompat.WithName("ollama"),
)
}Troubleshooting#
A 404 on every request
Check the base URL includes the version segment. Most of these need /v1;
Perplexity does not.
An unexpected 401 against a local runtime
You passed WithAPIKey(""), which still sends an Authorization header. Omit
the option entirely.
Model listing returns nothing useful
Coverage is host-dependent. OpenRouter supplies display names and context
windows; most others supply only IDs. ModelInfo.Raw has whatever they sent.