Skip to content
Draft
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
7 changes: 5 additions & 2 deletions src/api/providers/openrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,15 @@ export class OpenRouterHandler extends BaseProvider implements SingleCompletionH

// Convert Anthropic messages to OpenAI format.
// Pass normalization function for Mistral compatibility (requires 9-char alphanumeric IDs)
const isMistral = modelId.toLowerCase().includes("mistral")
// Also detect Devstral models which are part of the Mistral family
const isMistralFamily = modelId.toLowerCase().includes("mistral") || modelId.toLowerCase().includes("devstral")
let openAiMessages: OpenAI.Chat.ChatCompletionMessageParam[] = [
{ role: "system", content: systemPrompt },
...convertToOpenAiMessages(
messages,
isMistral ? { normalizeToolCallId: normalizeMistralToolCallId } : undefined,
isMistralFamily
? { normalizeToolCallId: normalizeMistralToolCallId, mergeToolResultText: true }
: undefined,
),
]

Expand Down
Loading