Custom OpenAI-compatible endpoints
Connect custom gateways, proxies, and model servers that speak chat completions.
Use OpenAICompatibleProvider for an endpoint without a dedicated pack—a
company gateway, a vLLM server, or a proxy:
let custom = OpenAICompatibleProvider(
name: "my-gateway",
baseURL: URL(string: "https://llm.your-company.com/v1")!,
apiKey: secret
)
let model = custom("openai/gpt-oss-20b")Model selection
There is no universal model list for a custom endpoint. The concrete
openai/gpt-oss-20b ID above is only an example; pass an ID returned by your
server's OpenAI-compatible GET /v1/models endpoint. If the service has a
dedicated provider page, use its first-class model type and catalog instead.
Features
Tools, structured output, and vision are encoded whenever you pass them; whether a given model honors them is between you and the model. Embeddings work against the same endpoints:
let embeddings = custom.textEmbeddingModel("BAAI/bge-large-en-v1.5")The reasoning parameter passes through as reasoning_effort. Models that
emit inline <think> blocks instead pair with the
extractReasoning middleware.
Named providers
Named services use their own model types and documentation pages. The old
OpenAICompatibleProvider.togetherAI(), .fireworks(), and similar factory
methods remain deprecated for source compatibility.