feat: restore Unbound as a provider

This commit is contained in:
Roo Code 2026-02-20 16:04:13 +00:00
parent b34678488e
commit c71a118540
42 changed files with 494 additions and 2 deletions

View file

@ -46,6 +46,8 @@ function getModelIdForProvider(config: ProviderSettings): string | undefined {
return config.openAiModelId
case "requesty":
return config.requestyModelId
case "unbound":
return config.unboundModelId
case "litellm":
return config.litellmModelId
case "vercel-ai-gateway":

View file

@ -264,6 +264,7 @@ export const SECRET_STATE_KEYS = [
"mistralApiKey",
"minimaxApiKey",
"requestyApiKey",
"unboundApiKey",
"xaiApiKey",
"litellmApiKey",
"codeIndexOpenAiKey",

View file

@ -34,7 +34,7 @@ export const DEFAULT_CONSECUTIVE_MISTAKE_LIMIT = 3
* Dynamic provider requires external API calls in order to get the model list.
*/
export const dynamicProviders = ["openrouter", "vercel-ai-gateway", "litellm", "requesty", "roo"] as const
export const dynamicProviders = ["openrouter", "vercel-ai-gateway", "litellm", "requesty", "roo", "unbound"] as const
export type DynamicProvider = (typeof dynamicProviders)[number]
@ -142,7 +142,6 @@ export const retiredProviderNames = [
"groq",
"huggingface",
"io-intelligence",
"unbound",
] as const
export const retiredProviderNamesSchema = z.enum(retiredProviderNames)
@ -327,6 +326,11 @@ const requestySchema = baseProviderSettingsSchema.extend({
requestyModelId: z.string().optional(),
})
const unboundSchema = baseProviderSettingsSchema.extend({
unboundApiKey: z.string().optional(),
unboundModelId: z.string().optional(),
})
const fakeAiSchema = baseProviderSettingsSchema.extend({
fakeAi: z.unknown().optional(),
})
@ -399,6 +403,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion("apiProv
moonshotSchema.merge(z.object({ apiProvider: z.literal("moonshot") })),
minimaxSchema.merge(z.object({ apiProvider: z.literal("minimax") })),
requestySchema.merge(z.object({ apiProvider: z.literal("requesty") })),
unboundSchema.merge(z.object({ apiProvider: z.literal("unbound") })),
fakeAiSchema.merge(z.object({ apiProvider: z.literal("fake-ai") })),
xaiSchema.merge(z.object({ apiProvider: z.literal("xai") })),
basetenSchema.merge(z.object({ apiProvider: z.literal("baseten") })),
@ -431,6 +436,7 @@ export const providerSettingsSchema = z.object({
...moonshotSchema.shape,
...minimaxSchema.shape,
...requestySchema.shape,
...unboundSchema.shape,
...fakeAiSchema.shape,
...xaiSchema.shape,
...basetenSchema.shape,
@ -468,6 +474,7 @@ export const modelIdKeys = [
"lmStudioModelId",
"lmStudioDraftModelId",
"requestyModelId",
"unboundModelId",
"litellmModelId",
"vercelAiGatewayModelId",
] as const satisfies readonly (keyof ProviderSettings)[]
@ -505,6 +512,7 @@ export const modelIdKeysByProvider: Record<TypicalProvider, ModelIdKey> = {
deepseek: "apiModelId",
"qwen-code": "apiModelId",
requesty: "requestyModelId",
unbound: "unboundModelId",
xai: "apiModelId",
baseten: "apiModelId",
litellm: "litellmModelId",
@ -627,6 +635,7 @@ export const MODELS_BY_PROVIDER: Record<
litellm: { id: "litellm", label: "LiteLLM", models: [] },
openrouter: { id: "openrouter", label: "OpenRouter", models: [] },
requesty: { id: "requesty", label: "Requesty", models: [] },
unbound: { id: "unbound", label: "Unbound", models: [] },
"vercel-ai-gateway": { id: "vercel-ai-gateway", label: "Vercel AI Gateway", models: [] },
// Local providers; models discovered from localhost endpoints.

View file

@ -17,6 +17,7 @@ export * from "./qwen-code.js"
export * from "./requesty.js"
export * from "./roo.js"
export * from "./sambanova.js"
export * from "./unbound.js"
export * from "./vertex.js"
export * from "./vscode-llm.js"
export * from "./xai.js"
@ -39,6 +40,7 @@ import { qwenCodeDefaultModelId } from "./qwen-code.js"
import { requestyDefaultModelId } from "./requesty.js"
import { rooDefaultModelId } from "./roo.js"
import { sambaNovaDefaultModelId } from "./sambanova.js"
import { unboundDefaultModelId } from "./unbound.js"
import { vertexDefaultModelId } from "./vertex.js"
import { vscodeLlmDefaultModelId } from "./vscode-llm.js"
import { xaiDefaultModelId } from "./xai.js"
@ -105,6 +107,8 @@ export function getProviderDefaultModelId(
return rooDefaultModelId
case "qwen-code":
return qwenCodeDefaultModelId
case "unbound":
return unboundDefaultModelId
case "vercel-ai-gateway":
return vercelAiGatewayDefaultModelId
case "anthropic":

View file

@ -0,0 +1,16 @@
import type { ModelInfo } from "../model.js"
// Unbound
// https://gateway.getunbound.ai
export const unboundDefaultModelId = "anthropic/claude-sonnet-4-5"
export const unboundDefaultModelInfo: ModelInfo = {
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsPromptCache: true,
inputPrice: 3.0,
outputPrice: 15.0,
cacheWritesPrice: 3.75,
cacheReadsPrice: 0.3,
}

View file

@ -21,6 +21,7 @@ import {
MistralHandler,
VsCodeLmHandler,
RequestyHandler,
UnboundHandler,
FakeAIHandler,
XAIHandler,
LiteLLMHandler,
@ -151,6 +152,8 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
return new MistralHandler(options)
case "requesty":
return new RequestyHandler(options)
case "unbound":
return new UnboundHandler(options)
case "fake-ai":
return new FakeAIHandler(options)
case "xai":

View file

@ -19,6 +19,7 @@ import { fileExistsAtPath } from "../../../utils/fs"
import { getOpenRouterModels } from "./openrouter"
import { getVercelAiGatewayModels } from "./vercel-ai-gateway"
import { getRequestyModels } from "./requesty"
import { getUnboundModels } from "./unbound"
import { getLiteLLMModels } from "./litellm"
import { GetModelsOptions } from "../../../shared/api"
import { getOllamaModels } from "./ollama"
@ -68,6 +69,9 @@ async function fetchModelsFromProvider(options: GetModelsOptions): Promise<Model
// Requesty models endpoint requires an API key for per-user custom policies.
models = await getRequestyModels(options.baseUrl, options.apiKey)
break
case "unbound":
models = await getUnboundModels(options.apiKey)
break
case "litellm":
// Type safety ensures apiKey and baseUrl are always provided for LiteLLM.
models = await getLiteLLMModels(options.apiKey, options.baseUrl)

View file

@ -0,0 +1,40 @@
import axios from "axios"
import type { ModelInfo } from "@roo-code/types"
import { parseApiPrice } from "../../../shared/cost"
export async function getUnboundModels(apiKey?: string | null): Promise<Record<string, ModelInfo>> {
const models: Record<string, ModelInfo> = {}
try {
const headers: Record<string, string> = {}
if (apiKey) {
headers["Authorization"] = `Bearer ${apiKey}`
}
const response = await axios.get("https://api.getunbound.ai/models", { headers })
const rawModels = response.data?.data ?? response.data
for (const rawModel of rawModels) {
const modelInfo: ModelInfo = {
maxTokens: rawModel.max_output_tokens ?? 8192,
contextWindow: rawModel.context_window ?? 200_000,
supportsPromptCache: rawModel.supports_caching ?? false,
supportsImages: rawModel.supports_vision ?? false,
inputPrice: parseApiPrice(rawModel.input_price),
outputPrice: parseApiPrice(rawModel.output_price),
description: rawModel.description,
cacheWritesPrice: parseApiPrice(rawModel.caching_price),
cacheReadsPrice: parseApiPrice(rawModel.cached_price),
}
models[rawModel.id] = modelInfo
}
} catch (error) {
console.error(`Error fetching Unbound models: ${JSON.stringify(error, Object.getOwnPropertyNames(error), 2)}`)
}
return models
}

View file

@ -17,6 +17,7 @@ export { OpenRouterHandler } from "./openrouter"
export { QwenCodeHandler } from "./qwen-code"
export { RequestyHandler } from "./requesty"
export { SambaNovaHandler } from "./sambanova"
export { UnboundHandler } from "./unbound"
export { VertexHandler } from "./vertex"
export { VsCodeLmHandler } from "./vscode-lm"
export { XAIHandler } from "./xai"

View file

@ -0,0 +1,212 @@
import { Anthropic } from "@anthropic-ai/sdk"
import OpenAI from "openai"
import { type ModelInfo, type ModelRecord, unboundDefaultModelId, unboundDefaultModelInfo } from "@roo-code/types"
import type { ApiHandlerOptions } from "../../shared/api"
import { calculateApiCostOpenAI } from "../../shared/cost"
import { convertToOpenAiMessages } from "../transform/openai-format"
import { ApiStream, ApiStreamUsageChunk } from "../transform/stream"
import { getModelParams } from "../transform/model-params"
import { OpenAiReasoningParams } from "../transform/reasoning"
import { DEFAULT_HEADERS } from "./constants"
import { getModels } from "./fetchers/modelCache"
import { BaseProvider } from "./base-provider"
import type { SingleCompletionHandler, ApiHandlerCreateMessageMetadata } from "../index"
import { handleOpenAIError } from "./utils/openai-error-handler"
import { applyRouterToolPreferences } from "./utils/router-tool-preferences"
// Unbound usage includes extra fields for Anthropic cache tokens.
interface UnboundUsage extends OpenAI.CompletionUsage {
cache_creation_input_tokens?: number
cache_read_input_tokens?: number
}
type UnboundChatCompletionParamsStreaming = OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming & {
unbound_metadata?: {
originApp?: string
taskId?: string
mode?: string
}
thinking?: OpenAiReasoningParams
}
type UnboundChatCompletionParams = OpenAI.Chat.ChatCompletionCreateParams & {
unbound_metadata?: {
originApp?: string
taskId?: string
mode?: string
}
thinking?: OpenAiReasoningParams
}
export class UnboundHandler extends BaseProvider implements SingleCompletionHandler {
protected options: ApiHandlerOptions
protected models: ModelRecord = {}
private client: OpenAI
private readonly providerName = "Unbound"
constructor(options: ApiHandlerOptions) {
super()
this.options = options
const apiKey = this.options.unboundApiKey ?? "not-provided"
this.client = new OpenAI({
baseURL: "https://api.getunbound.ai/v1",
apiKey: apiKey,
defaultHeaders: {
...DEFAULT_HEADERS,
"X-Unbound-Metadata": JSON.stringify({ labels: [{ key: "app", value: "roo-code" }] }),
},
})
}
public async fetchModel() {
this.models = await getModels({ provider: "unbound", apiKey: this.options.unboundApiKey })
return this.getModel()
}
override getModel() {
const id = this.options.unboundModelId ?? unboundDefaultModelId
const cachedInfo = this.models[id] ?? unboundDefaultModelInfo
let info: ModelInfo = cachedInfo
// Apply tool preferences for models accessed through routers (OpenAI, Gemini)
info = applyRouterToolPreferences(id, info)
const params = getModelParams({
format: "openai",
modelId: id,
model: info,
settings: this.options,
defaultTemperature: 0,
})
return { id, info, ...params }
}
protected processUsageMetrics(usage: any, modelInfo?: ModelInfo): ApiStreamUsageChunk {
const unboundUsage = usage as UnboundUsage
const inputTokens = unboundUsage?.prompt_tokens || 0
const outputTokens = unboundUsage?.completion_tokens || 0
const cacheWriteTokens = unboundUsage?.cache_creation_input_tokens || 0
const cacheReadTokens = unboundUsage?.cache_read_input_tokens || 0
const { totalCost } = modelInfo
? calculateApiCostOpenAI(modelInfo, inputTokens, outputTokens, cacheWriteTokens, cacheReadTokens)
: { totalCost: 0 }
return {
type: "usage",
inputTokens: inputTokens,
outputTokens: outputTokens,
cacheWriteTokens: cacheWriteTokens,
cacheReadTokens: cacheReadTokens,
totalCost: totalCost,
}
}
override async *createMessage(
systemPrompt: string,
messages: Anthropic.Messages.MessageParam[],
metadata?: ApiHandlerCreateMessageMetadata,
): ApiStream {
const {
id: model,
info,
maxTokens: max_tokens,
temperature,
reasoningEffort: reasoning_effort,
reasoning: thinking,
} = await this.fetchModel()
const openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [
{ role: "system", content: systemPrompt },
...convertToOpenAiMessages(messages),
]
// Map extended efforts to OpenAI Chat Completions-accepted values (omit unsupported)
const allowedEffort = (["low", "medium", "high"] as const).includes(reasoning_effort as any)
? (reasoning_effort as OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming["reasoning_effort"])
: undefined
const completionParams: UnboundChatCompletionParamsStreaming = {
messages: openAiMessages,
model,
max_tokens,
temperature,
...(allowedEffort && { reasoning_effort: allowedEffort }),
...(thinking && { thinking }),
stream: true,
stream_options: { include_usage: true },
unbound_metadata: { originApp: "roo-code", taskId: metadata?.taskId, mode: metadata?.mode },
tools: this.convertToolsForOpenAI(metadata?.tools),
tool_choice: metadata?.tool_choice,
}
let stream
try {
stream = await this.client.chat.completions.create(completionParams)
} catch (error) {
throw handleOpenAIError(error, this.providerName)
}
let lastUsage: any = undefined
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta
if (delta?.content) {
yield { type: "text", text: delta.content }
}
if (delta && "reasoning_content" in delta && delta.reasoning_content) {
yield { type: "reasoning", text: (delta.reasoning_content as string | undefined) || "" }
}
// Handle native tool calls
if (delta && "tool_calls" in delta && Array.isArray(delta.tool_calls)) {
for (const toolCall of delta.tool_calls) {
yield {
type: "tool_call_partial",
index: toolCall.index,
id: toolCall.id,
name: toolCall.function?.name,
arguments: toolCall.function?.arguments,
}
}
}
if (chunk.usage) {
lastUsage = chunk.usage
}
}
if (lastUsage) {
yield this.processUsageMetrics(lastUsage, info)
}
}
async completePrompt(prompt: string): Promise<string> {
const { id: model, maxTokens: max_tokens, temperature } = await this.fetchModel()
let openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [{ role: "system", content: prompt }]
const completionParams: UnboundChatCompletionParams = {
model,
max_tokens,
messages: openAiMessages,
temperature: temperature,
}
let response: OpenAI.Chat.ChatCompletion
try {
response = await this.client.chat.completions.create(completionParams)
} catch (error) {
throw handleOpenAIError(error, this.providerName)
}
return response.choices[0]?.message.content || ""
}
}

View file

@ -2468,6 +2468,7 @@ describe("ClineProvider - Router Models", () => {
// Verify getModels was called for each provider with correct options
expect(getModels).toHaveBeenCalledWith({ provider: "openrouter" })
expect(getModels).toHaveBeenCalledWith({ provider: "requesty", apiKey: "requesty-key" })
expect(getModels).toHaveBeenCalledWith({ provider: "unbound" })
expect(getModels).toHaveBeenCalledWith({ provider: "vercel-ai-gateway" })
expect(getModels).toHaveBeenCalledWith(
expect.objectContaining({
@ -2487,6 +2488,7 @@ describe("ClineProvider - Router Models", () => {
routerModels: {
openrouter: mockModels,
requesty: mockModels,
unbound: mockModels,
roo: mockModels,
litellm: mockModels,
ollama: {},
@ -2519,6 +2521,7 @@ describe("ClineProvider - Router Models", () => {
vi.mocked(getModels)
.mockResolvedValueOnce(mockModels) // openrouter success
.mockRejectedValueOnce(new Error("Requesty API error")) // requesty fail
.mockResolvedValueOnce(mockModels) // unbound success
.mockResolvedValueOnce(mockModels) // vercel-ai-gateway success
.mockResolvedValueOnce(mockModels) // roo success
.mockRejectedValueOnce(new Error("LiteLLM connection failed")) // litellm fail
@ -2531,6 +2534,7 @@ describe("ClineProvider - Router Models", () => {
routerModels: {
openrouter: mockModels,
requesty: {},
unbound: mockModels,
roo: mockModels,
ollama: {},
lmstudio: {},
@ -2624,6 +2628,7 @@ describe("ClineProvider - Router Models", () => {
routerModels: {
openrouter: mockModels,
requesty: mockModels,
unbound: mockModels,
roo: mockModels,
litellm: {},
ollama: {},

View file

@ -296,6 +296,11 @@ describe("webviewMessageHandler - requestRouterModels", () => {
// Verify getModels was called for each provider
expect(mockGetModels).toHaveBeenCalledWith({ provider: "openrouter" })
expect(mockGetModels).toHaveBeenCalledWith({ provider: "requesty", apiKey: "requesty-key" })
expect(mockGetModels).toHaveBeenCalledWith(
expect.objectContaining({
provider: "unbound",
}),
)
expect(mockGetModels).toHaveBeenCalledWith({ provider: "vercel-ai-gateway" })
expect(mockGetModels).toHaveBeenCalledWith(
expect.objectContaining({
@ -315,6 +320,7 @@ describe("webviewMessageHandler - requestRouterModels", () => {
routerModels: {
openrouter: mockModels,
requesty: mockModels,
unbound: mockModels,
litellm: mockModels,
roo: mockModels,
ollama: {},
@ -399,6 +405,7 @@ describe("webviewMessageHandler - requestRouterModels", () => {
routerModels: {
openrouter: mockModels,
requesty: mockModels,
unbound: mockModels,
roo: mockModels,
litellm: {},
ollama: {},
@ -423,6 +430,7 @@ describe("webviewMessageHandler - requestRouterModels", () => {
mockGetModels
.mockResolvedValueOnce(mockModels) // openrouter
.mockRejectedValueOnce(new Error("Requesty API error")) // requesty
.mockResolvedValueOnce(mockModels) // unbound
.mockResolvedValueOnce(mockModels) // vercel-ai-gateway
.mockResolvedValueOnce(mockModels) // roo
.mockRejectedValueOnce(new Error("LiteLLM connection failed")) // litellm
@ -452,6 +460,7 @@ describe("webviewMessageHandler - requestRouterModels", () => {
routerModels: {
openrouter: mockModels,
requesty: {},
unbound: mockModels,
roo: mockModels,
litellm: {},
ollama: {},
@ -467,6 +476,7 @@ describe("webviewMessageHandler - requestRouterModels", () => {
mockGetModels
.mockRejectedValueOnce(new Error("Structured error message")) // openrouter
.mockRejectedValueOnce(new Error("Requesty API error")) // requesty
.mockRejectedValueOnce(new Error("Unbound error")) // unbound
.mockRejectedValueOnce(new Error("Vercel AI Gateway error")) // vercel-ai-gateway
.mockRejectedValueOnce(new Error("Roo API error")) // roo
.mockRejectedValueOnce(new Error("LiteLLM connection failed")) // litellm
@ -490,6 +500,13 @@ describe("webviewMessageHandler - requestRouterModels", () => {
values: { provider: "requesty" },
})
expect(mockClineProvider.postMessageToWebview).toHaveBeenCalledWith({
type: "singleRouterModelFetchResponse",
success: false,
error: "Unbound error",
values: { provider: "unbound" },
})
expect(mockClineProvider.postMessageToWebview).toHaveBeenCalledWith({
type: "singleRouterModelFetchResponse",
success: false,

View file

@ -876,6 +876,7 @@ export const webviewMessageHandler = async (
"vercel-ai-gateway": {},
litellm: {},
requesty: {},
unbound: {},
ollama: {},
lmstudio: {},
roo: {},
@ -905,6 +906,13 @@ export const webviewMessageHandler = async (
baseUrl: apiConfiguration.requestyBaseUrl,
},
},
{
key: "unbound",
options: {
provider: "unbound",
apiKey: apiConfiguration.unboundApiKey,
},
},
{ key: "vercel-ai-gateway", options: { provider: "vercel-ai-gateway" } },
{
key: "roo",

View file

@ -77,6 +77,8 @@ export class ProfileValidator {
return profile.ollamaModelId
case "requesty":
return profile.requestyModelId
case "unbound":
return profile.unboundModelId
case "fake-ai":
default:
return undefined

View file

@ -173,6 +173,7 @@ const dynamicProviderExtras = {
"vercel-ai-gateway": {} as {}, // eslint-disable-line @typescript-eslint/no-empty-object-type
litellm: {} as { apiKey: string; baseUrl: string },
requesty: {} as { apiKey?: string; baseUrl?: string },
unbound: {} as { apiKey?: string },
ollama: {} as {}, // eslint-disable-line @typescript-eslint/no-empty-object-type
lmstudio: {} as {}, // eslint-disable-line @typescript-eslint/no-empty-object-type
roo: {} as { apiKey?: string; baseUrl?: string },

View file

@ -31,6 +31,7 @@ import {
rooDefaultModelId,
vercelAiGatewayDefaultModelId,
minimaxDefaultModelId,
unboundDefaultModelId,
} from "@roo-code/types"
import {
@ -83,6 +84,7 @@ import {
Requesty,
Roo,
SambaNova,
Unbound,
Vertex,
VSCodeLM,
XAI,
@ -330,6 +332,7 @@ const ApiOptions = ({
> = {
openrouter: { field: "openRouterModelId", default: openRouterDefaultModelId },
requesty: { field: "requestyModelId", default: requestyDefaultModelId },
unbound: { field: "unboundModelId", default: unboundDefaultModelId },
litellm: { field: "litellmModelId", default: litellmDefaultModelId },
anthropic: { field: "apiModelId", default: anthropicDefaultModelId },
"openai-codex": { field: "apiModelId", default: openAiCodexDefaultModelId },
@ -518,6 +521,18 @@ const ApiOptions = ({
/>
)}
{selectedProvider === "unbound" && (
<Unbound
apiConfiguration={apiConfiguration}
setApiConfigurationField={setApiConfigurationField}
routerModels={routerModels}
refetchRouterModels={refetchRouterModels}
organizationAllowList={organizationAllowList}
modelValidationError={modelValidationError}
simplifySettings={fromWelcomeView}
/>
)}
{selectedProvider === "anthropic" && (
<Anthropic
apiConfiguration={apiConfiguration}

View file

@ -30,6 +30,7 @@ type ModelIdKey = keyof Pick<
ProviderSettings,
| "openRouterModelId"
| "requestyModelId"
| "unboundModelId"
| "openAiModelId"
| "litellmModelId"
| "vercelAiGatewayModelId"

View file

@ -64,4 +64,5 @@ export const PROVIDERS = [
{ value: "vercel-ai-gateway", label: "Vercel AI Gateway", proxy: false },
{ value: "minimax", label: "MiniMax", proxy: false },
{ value: "baseten", label: "Baseten", proxy: false },
{ value: "unbound", label: "Unbound", proxy: false },
].sort((a, b) => a.label.localeCompare(b.label))

View file

@ -0,0 +1,101 @@
import { useCallback } from "react"
import { VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
import {
type ProviderSettings,
type OrganizationAllowList,
type RouterModels,
unboundDefaultModelId,
} from "@roo-code/types"
import { vscode } from "@src/utils/vscode"
import { useAppTranslation } from "@src/i18n/TranslationContext"
import { Button } from "@src/components/ui"
import { inputEventTransform } from "../transforms"
import { ModelPicker } from "../ModelPicker"
type UnboundProps = {
apiConfiguration: ProviderSettings
setApiConfigurationField: (field: keyof ProviderSettings, value: ProviderSettings[keyof ProviderSettings]) => void
routerModels?: RouterModels
refetchRouterModels: () => void
organizationAllowList: OrganizationAllowList
modelValidationError?: string
simplifySettings?: boolean
}
export const Unbound = ({
apiConfiguration,
setApiConfigurationField,
routerModels,
organizationAllowList,
modelValidationError,
simplifySettings,
}: UnboundProps) => {
const { t } = useAppTranslation()
const handleInputChange = useCallback(
<K extends keyof ProviderSettings, E>(
field: K,
transform: (event: E) => ProviderSettings[K] = inputEventTransform,
) =>
(event: E | Event) => {
setApiConfigurationField(field, transform(event as E))
},
[setApiConfigurationField],
)
return (
<>
<VSCodeTextField
value={apiConfiguration?.unboundApiKey || ""}
type="password"
onInput={handleInputChange("unboundApiKey")}
placeholder={t("settings:providers.unboundApiKey")}
className="w-full">
<div className="flex justify-between items-center mb-1">
<label className="block font-medium">{t("settings:providers.unboundApiKey")}</label>
</div>
</VSCodeTextField>
<div className="text-sm text-vscode-descriptionForeground -mt-2">
{t("settings:providers.apiKeyStorageNotice")}
</div>
<a
href="https://gateway.getunbound.ai"
target="_blank"
rel="noopener noreferrer"
className="inline-flex items-center justify-center whitespace-nowrap text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground shadow hover:bg-primary/90 h-9 rounded-md px-3 w-full"
style={{
width: "100%",
textDecoration: "none",
color: "var(--vscode-button-foreground)",
backgroundColor: "var(--vscode-button-background)",
}}>
{t("settings:providers.getUnboundApiKey")}
</a>
<Button
variant="outline"
onClick={() => {
vscode.postMessage({ type: "requestRouterModels", values: { provider: "unbound", refresh: true } })
}}>
<div className="flex items-center gap-2">
<span className="codicon codicon-refresh" />
{t("settings:providers.refreshModels.label")}
</div>
</Button>
<ModelPicker
apiConfiguration={apiConfiguration}
setApiConfigurationField={setApiConfigurationField}
defaultModelId={unboundDefaultModelId}
models={routerModels?.unbound ?? {}}
modelIdKey="unboundModelId"
serviceName="Unbound"
serviceUrl="https://api.getunbound.ai/models"
organizationAllowList={organizationAllowList}
errorMessage={modelValidationError}
simplifySettings={simplifySettings}
/>
</>
)
}

View file

@ -14,6 +14,7 @@ export { QwenCode } from "./QwenCode"
export { Roo } from "./Roo"
export { Requesty } from "./Requesty"
export { SambaNova } from "./SambaNova"
export { Unbound } from "./Unbound"
export { Vertex } from "./Vertex"
export { VSCodeLM } from "./VSCodeLM"
export { XAI } from "./XAI"

View file

@ -118,6 +118,7 @@ export const isStaticModelProvider = (provider: ProviderName): boolean => {
export const PROVIDERS_WITH_CUSTOM_MODEL_UI: ProviderName[] = [
"openrouter",
"requesty",
"unbound",
"openai", // OpenAI Compatible
"openai-codex", // OpenAI Codex has custom UI with auth and rate limits
"litellm",

View file

@ -159,6 +159,11 @@ function getSelectedModel({
const routerInfo = routerModels.requesty?.[id]
return { id, info: routerInfo }
}
case "unbound": {
const id = getValidatedModelId(apiConfiguration.unboundModelId, routerModels.unbound, defaultModelId)
const routerInfo = routerModels.unbound?.[id]
return { id, info: routerInfo }
}
case "litellm": {
const id = getValidatedModelId(apiConfiguration.litellmModelId, routerModels.litellm, defaultModelId)
const routerInfo = routerModels.litellm?.[id]

View file

@ -356,6 +356,8 @@
"headerName": "Nom de la capçalera",
"headerValue": "Valor de la capçalera",
"noCustomHeaders": "No hi ha capçaleres personalitzades definides. Feu clic al botó + per afegir-ne una.",
"unboundApiKey": "Clau API de Unbound",
"getUnboundApiKey": "Obtenir clau API de Unbound",
"requestyApiKey": "Clau API de Requesty",
"refreshModels": {
"label": "Actualitzar models",

View file

@ -356,6 +356,8 @@
"headerName": "Header-Name",
"headerValue": "Header-Wert",
"noCustomHeaders": "Keine benutzerdefinierten Headers definiert. Klicke auf die + Schaltfläche, um einen hinzuzufügen.",
"unboundApiKey": "Unbound API-Schlüssel",
"getUnboundApiKey": "Unbound API-Schlüssel erhalten",
"requestyApiKey": "Requesty API-Schlüssel",
"refreshModels": {
"label": "Modelle aktualisieren",

View file

@ -419,6 +419,8 @@
"headerName": "Header name",
"headerValue": "Header value",
"noCustomHeaders": "No custom headers defined. Click the + button to add one.",
"unboundApiKey": "Unbound API Key",
"getUnboundApiKey": "Get Unbound API Key",
"requestyApiKey": "Requesty API Key",
"refreshModels": {
"label": "Refresh Models",

View file

@ -356,6 +356,8 @@
"headerName": "Nombre del encabezado",
"headerValue": "Valor del encabezado",
"noCustomHeaders": "No hay encabezados personalizados definidos. Haga clic en el botón + para añadir uno.",
"unboundApiKey": "Clave API de Unbound",
"getUnboundApiKey": "Obtener clave API de Unbound",
"requestyApiKey": "Clave API de Requesty",
"refreshModels": {
"label": "Actualizar modelos",

View file

@ -356,6 +356,8 @@
"headerName": "Nom de l'en-tête",
"headerValue": "Valeur de l'en-tête",
"noCustomHeaders": "Aucun en-tête personnalisé défini. Cliquez sur le bouton + pour en ajouter un.",
"unboundApiKey": "Clé API Unbound",
"getUnboundApiKey": "Obtenir la clé API Unbound",
"requestyApiKey": "Clé API Requesty",
"refreshModels": {
"label": "Actualiser les modèles",

View file

@ -356,6 +356,8 @@
"headerName": "हेडर नाम",
"headerValue": "हेडर मूल्य",
"noCustomHeaders": "कोई कस्टम हेडर परिभाषित नहीं है। एक जोड़ने के लिए + बटन पर क्लिक करें।",
"unboundApiKey": "Unbound API कुंजी",
"getUnboundApiKey": "Unbound API कुंजी प्राप्त करें",
"requestyApiKey": "Requesty API कुंजी",
"refreshModels": {
"label": "मॉडल रिफ्रेश करें",

View file

@ -356,6 +356,8 @@
"headerName": "Nama header",
"headerValue": "Nilai header",
"noCustomHeaders": "Tidak ada header kustom yang didefinisikan. Klik tombol + untuk menambahkan satu.",
"unboundApiKey": "Unbound API Key",
"getUnboundApiKey": "Dapatkan Unbound API Key",
"requestyApiKey": "Requesty API Key",
"refreshModels": {
"label": "Refresh Model",

View file

@ -356,6 +356,8 @@
"headerName": "Nome intestazione",
"headerValue": "Valore intestazione",
"noCustomHeaders": "Nessuna intestazione personalizzata definita. Fai clic sul pulsante + per aggiungerne una.",
"unboundApiKey": "Chiave API Unbound",
"getUnboundApiKey": "Ottieni chiave API Unbound",
"requestyApiKey": "Chiave API Requesty",
"refreshModels": {
"label": "Aggiorna modelli",

View file

@ -356,6 +356,8 @@
"headerName": "ヘッダー名",
"headerValue": "ヘッダー値",
"noCustomHeaders": "カスタムヘッダーが定義されていません。+ ボタンをクリックして追加してください。",
"unboundApiKey": "Unbound API キー",
"getUnboundApiKey": "Unbound APIキーを取得",
"requestyApiKey": "Requesty APIキー",
"refreshModels": {
"label": "モデルを更新",

View file

@ -356,6 +356,8 @@
"headerName": "헤더 이름",
"headerValue": "헤더 값",
"noCustomHeaders": "정의된 사용자 정의 헤더가 없습니다. + 버튼을 클릭하여 추가하세요.",
"unboundApiKey": "Unbound API 키",
"getUnboundApiKey": "Unbound API 키 받기",
"requestyApiKey": "Requesty API 키",
"refreshModels": {
"label": "모델 새로고침",

View file

@ -356,6 +356,8 @@
"headerName": "Headernaam",
"headerValue": "Headerwaarde",
"noCustomHeaders": "Geen aangepaste headers gedefinieerd. Klik op de + knop om er een toe te voegen.",
"unboundApiKey": "Unbound API sleutel",
"getUnboundApiKey": "Unbound API-sleutel ophalen",
"requestyApiKey": "Requesty API-sleutel",
"refreshModels": {
"label": "Modellen verversen",

View file

@ -356,6 +356,8 @@
"headerName": "Nazwa nagłówka",
"headerValue": "Wartość nagłówka",
"noCustomHeaders": "Brak zdefiniowanych niestandardowych nagłówków. Kliknij przycisk +, aby dodać.",
"unboundApiKey": "Klucz API Unbound",
"getUnboundApiKey": "Uzyskaj klucz API Unbound",
"requestyApiKey": "Klucz API Requesty",
"refreshModels": {
"label": "Odśwież modele",

View file

@ -356,6 +356,8 @@
"headerName": "Nome do cabeçalho",
"headerValue": "Valor do cabeçalho",
"noCustomHeaders": "Nenhum cabeçalho personalizado definido. Clique no botão + para adicionar um.",
"unboundApiKey": "Chave de API Unbound",
"getUnboundApiKey": "Obter chave de API Unbound",
"requestyApiKey": "Chave de API Requesty",
"refreshModels": {
"label": "Atualizar modelos",

View file

@ -356,6 +356,8 @@
"headerName": "Имя заголовка",
"headerValue": "Значение заголовка",
"noCustomHeaders": "Пользовательские заголовки не определены. Нажмите кнопку +, чтобы добавить.",
"unboundApiKey": "Unbound API-ключ",
"getUnboundApiKey": "Получить Unbound API-ключ",
"requestyApiKey": "Requesty API-ключ",
"refreshModels": {
"label": "Обновить модели",

View file

@ -356,6 +356,8 @@
"headerName": "Başlık adı",
"headerValue": "Başlık değeri",
"noCustomHeaders": "Tanımlanmış özel başlık yok. Eklemek için + düğmesine tıklayın.",
"unboundApiKey": "Unbound API Anahtarı",
"getUnboundApiKey": "Unbound API Anahtarı Al",
"requestyApiKey": "Requesty API Anahtarı",
"refreshModels": {
"label": "Modelleri Yenile",

View file

@ -356,6 +356,8 @@
"headerName": "Tên tiêu đề",
"headerValue": "Giá trị tiêu đề",
"noCustomHeaders": "Chưa có tiêu đề tùy chỉnh nào được định nghĩa. Nhấp vào nút + để thêm.",
"unboundApiKey": "Khóa API Unbound",
"getUnboundApiKey": "Lấy khóa API Unbound",
"requestyApiKey": "Khóa API Requesty",
"refreshModels": {
"label": "Làm mới mô hình",

View file

@ -356,6 +356,8 @@
"headerName": "标头名称",
"headerValue": "标头值",
"noCustomHeaders": "暂无自定义标头。点击 + 按钮添加。",
"unboundApiKey": "Unbound API 密钥",
"getUnboundApiKey": "获取 Unbound API 密钥",
"requestyApiKey": "Requesty API 密钥",
"refreshModels": {
"label": "刷新模型",

View file

@ -366,6 +366,8 @@
"headerName": "標頭名稱",
"headerValue": "標頭值",
"noCustomHeaders": "尚未定義自訂標頭。點選 + 按鈕以新增。",
"unboundApiKey": "Unbound API 金鑰",
"getUnboundApiKey": "取得 Unbound API 金鑰",
"requestyApiKey": "Requesty API 金鑰",
"refreshModels": {
"label": "重新整理模型",

View file

@ -39,6 +39,7 @@ describe("Model Validation Functions", () => {
},
},
requesty: {},
unbound: {},
litellm: {},
ollama: {},
lmstudio: {},

View file

@ -48,6 +48,11 @@ function validateModelsAndKeysProvided(apiConfiguration: ProviderSettings): stri
return i18next.t("settings:validation.apiKey")
}
break
case "unbound":
if (!apiConfiguration.unboundApiKey) {
return i18next.t("settings:validation.apiKey")
}
break
case "litellm":
if (!apiConfiguration.litellmApiKey) {
return i18next.t("settings:validation.apiKey")