Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/providers/fetchers/__tests__/roo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ describe("getRooModels", () => {
description: "Fast coding model",
deprecated: false,
isFree: false,
defaultToolProtocol: "native", // Applied from MODEL_DEFAULTS
},
})
})
Expand Down
21 changes: 19 additions & 2 deletions src/api/providers/fetchers/roo.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import { RooModelsResponseSchema } from "@roo-code/types"
import { RooModelsResponseSchema, type ModelInfo } from "@roo-code/types"

import type { ModelRecord } from "../../../shared/api"
import { parseApiPrice } from "../../../shared/cost"

import { DEFAULT_HEADERS } from "../constants"

// Model-specific defaults that should be applied even when models come from API cache
// These override API-provided values for specific models
// Exported so RooHandler.getModel() can also apply these for fallback cases
export const MODEL_DEFAULTS: Record<string, Partial<ModelInfo>> = {
"minimax/minimax-m2": {
defaultToolProtocol: "native",
},
"anthropic/claude-haiku-4.5": {
defaultToolProtocol: "native",
},
"xai/grok-code-fast-1": {
defaultToolProtocol: "native",
},
}

/**
* Fetches available models from the Roo Code Cloud provider
*
Expand Down Expand Up @@ -119,7 +134,9 @@ export async function getRooModels(baseUrl: string, apiKey?: string): Promise<Mo
isFree: tags.includes("free"),
}

models[modelId] = baseModelInfo
// Apply model-specific defaults (e.g., defaultToolProtocol)
const modelDefaults = MODEL_DEFAULTS[modelId]
models[modelId] = modelDefaults ? { ...baseModelInfo, ...modelDefaults } : baseModelInfo
}

return models
Expand Down
13 changes: 1 addition & 12 deletions src/api/providers/roo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,11 @@ import { getRooReasoning } from "../transform/reasoning"
import type { ApiHandlerCreateMessageMetadata } from "../index"
import { BaseOpenAiCompatibleProvider } from "./base-openai-compatible-provider"
import { getModels, getModelsFromCache } from "../providers/fetchers/modelCache"
import { MODEL_DEFAULTS } from "../providers/fetchers/roo"
import { handleOpenAIError } from "./utils/openai-error-handler"
import { generateImageWithProvider, generateImageWithImagesApi, ImageGenerationResult } from "./utils/image-generation"
import { t } from "../../i18n"

import type { ModelInfo } from "@roo-code/types"

// Model-specific defaults that should be applied even when models come from API cache
const MODEL_DEFAULTS: Record<string, Partial<ModelInfo>> = {
"minimax/minimax-m2": {
defaultToolProtocol: "native",
},
"anthropic/claude-haiku-4.5": {
defaultToolProtocol: "native",
},
}

// Extend OpenAI's CompletionUsage to include Roo specific fields
interface RooUsage extends OpenAI.CompletionUsage {
cache_creation_input_tokens?: number
Expand Down
Loading