Skip to content

OpenAiCompatibleModelFactory.mistral uses incorrect base URL #1937

Description

@arnabnandy7

Problem

OpenAiCompatibleModelFactory.mistral() configures the OpenAI-compatible client with:

https://api.mistral.ai

The OpenAI Java client appends /chat/completions, so validation calls are sent to:

https://api.mistral.ai/chat/completions

Mistral exposes the OpenAI-compatible endpoint under /v1, making the request return HTTP 404. The expected endpoint is:

https://api.mistral.ai/v1/chat/completions

This causes OpenAiCompatibleModelFactoryByokIT.mistral buildValidated succeeds with valid key to fail when MISTRAL_API_KEY is configured.

Proposed fix

Change the Mistral base URL in OpenAiCompatibleModelFactory.mistral() to:

https://api.mistral.ai/v1

The change should remain provider-specific. The generic factory must not append /v1, because other OpenAI-compatible providers use different versioned paths, such as Gemini's /v1beta/openai, and custom providers may use arbitrary paths.

Regression coverage

  • Run the existing Mistral BYOK integration test with MISTRAL_API_KEY and confirm buildValidated() succeeds.
  • Where practical, add a credential-free request-path test confirming that a /v1 base URL results in a request to /v1/chat/completions.

Acceptance criteria

  • OpenAiCompatibleModelFactory.mistral() sends chat-completion requests to https://api.mistral.ai/v1/chat/completions.
  • The live Mistral BYOK integration test passes with a valid key.
  • Other named and custom OpenAI-compatible providers are unchanged.

Reference: #1929 (review)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions