Fix vLLM inference endpoint setup

This commit is contained in:
Codex
2026-04-28 17:14:09 +00:00
parent 476d3a96bb
commit 05d77aace0
3 changed files with 29 additions and 17 deletions
+11 -2
View File
@@ -101,6 +101,14 @@ function optionalString(value: unknown) {
return typeof value === "string" ? value.trim() : ""
}
function isVllmEndpoint(name: string, baseUrl: string) {
return [name, baseUrl].some((value) => /vllm/i.test(value))
}
function normalizeProviderType(type: string, name: string, baseUrl: string) {
return isVllmEndpoint(name, baseUrl) ? "openai" : type
}
function redactSecretOutput(value: string, secrets: string[] = []) {
let redacted = value
for (const secret of secrets) {
@@ -132,14 +140,15 @@ export async function POST(request: Request) {
try {
const body = await request.json()
const name = validateName(body?.name)
const type = validateProviderType(body?.type)
const requestedType = validateProviderType(body?.type)
const model = optionalString(body?.model)
const baseUrl = optionalString(body?.baseUrl)
const type = normalizeProviderType(requestedType, name, baseUrl)
const apiKey = optionalString(body?.apiKey)
const credentialKey = optionalString(body?.credentialKey) || "OPENAI_API_KEY"
const makeActive = body?.makeActive !== false
const system = body?.route === "system" || body?.system === true
const noVerify = body?.noVerify !== false
const noVerify = body?.noVerify !== false || isVllmEndpoint(name, baseUrl)
const timeout = Number(body?.timeout ?? 0)
if (makeActive && !model) throw new Error("model is required when making the endpoint active")
+13 -13
View File
@@ -36,7 +36,6 @@ type OllamaModel = {
const providerTypeOptions = [
{ value: "openai", label: "OpenAI compatible" },
{ value: "nvidia", label: "NVIDIA" },
{ value: "anthropic", label: "Anthropic" },
{ value: "generic", label: "Generic" },
]
@@ -56,11 +55,11 @@ export default function InferenceEndpointPanel() {
const [providers, setProviders] = useState<ProviderSummary[]>([])
const [gateway, setGateway] = useState<InferenceRoute>(emptyRoute)
const [system, setSystem] = useState<InferenceRoute>(emptyRoute)
const [name, setName] = useState("nvidia-nim")
const [name, setName] = useState("vllm-local")
const [type, setType] = useState("openai")
const [model, setModel] = useState("nvidia/nemotron-3-super-120b-a12b")
const [baseUrl, setBaseUrl] = useState("https://integrate.api.nvidia.com/v1")
const [credentialKey, setCredentialKey] = useState("NVIDIA_API_KEY")
const [model, setModel] = useState("nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4")
const [baseUrl, setBaseUrl] = useState("http://host.docker.internal:8000/v1")
const [credentialKey, setCredentialKey] = useState("OPENAI_API_KEY")
const [apiKey, setApiKey] = useState("")
const [route, setRoute] = useState<"gateway" | "system">("gateway")
const [timeout, setTimeoutValue] = useState("0")
@@ -141,15 +140,16 @@ export default function InferenceEndpointPanel() {
setMessage(`Loaded ${provider.name}. Enter a model and save to make it active.`)
}
function useNvidiaInferencePreset() {
setName("nvidia-inference")
function useVllmPreset() {
setName("vllm-local")
setType("openai")
setModel("aws/anthropic/claude-opus-4-5")
setBaseUrl("https://inference-api.nvidia.com/v1")
setCredentialKey("NVIDIA_API_KEY")
setModel("nvidia/NVIDIA-Nemotron-3-Super-120B-A12B-NVFP4")
setBaseUrl("http://host.docker.internal:8000/v1")
setCredentialKey("OPENAI_API_KEY")
setApiKey("")
setRoute("gateway")
setNoVerify(true)
setMessage("NVIDIA inference preset loaded. Enter an API key, then save the endpoint.")
setMessage("vLLM preset loaded. Adjust the endpoint URL if your server is bound somewhere else, then save.")
}
async function saveEndpoint() {
@@ -333,8 +333,8 @@ export default function InferenceEndpointPanel() {
<button onClick={saveEndpoint} disabled={saving} className="px-4 py-2 rounded-sm bg-[var(--nvidia-green)] text-white text-xs font-mono uppercase tracking-wider disabled:opacity-50">
{saving ? "Saving..." : "Save Endpoint"}
</button>
<button type="button" onClick={useNvidiaInferencePreset} disabled={saving} className="px-4 py-2 rounded-sm bg-[var(--background-tertiary)] text-[var(--foreground)] text-xs font-mono uppercase tracking-wider hover:bg-[var(--background-secondary)] disabled:opacity-50">
NVIDIA Preset
<button type="button" onClick={useVllmPreset} disabled={saving} className="px-4 py-2 rounded-sm bg-[var(--background-tertiary)] text-[var(--foreground)] text-xs font-mono uppercase tracking-wider hover:bg-[var(--background-secondary)] disabled:opacity-50">
vLLM Preset
</button>
{message && <p className="text-xs text-[var(--foreground-dim)] whitespace-pre-wrap">{message}</p>}
</div>