Skip to content

LLM connection test reports OK with an invalid API key #1006

Backlog

Description

@Sev7eNup

Problem

The LLM profile "Test connection" button can report success with an invalid API key.

SettingsTestProbe.TestLlmAsync (src/NodePilot.Api/Services/SettingsTestProbe.cs) only sends GET {ApiRoot}/models and treats any 2xx as success. Some OpenAI-compatible servers answer /models without authentication. llama.cpp's llama-server started with --api-key serves /models (and /v1/models) as a public endpoint, so the probe returns "accepted the probe" with a wrong or missing key. Real requests (chat/responses) then fail with LLM_UNAUTHORIZED.

Expected

A green test result means the configured key is accepted for real requests.

Notes

  • The probe's doc comment claims /models is a check for "does my key work". That holds for OpenAI Cloud but not for every server the probe targets.
  • Possible directions: a minimal authenticated request after /models (e.g. a one-token completion against the profile's model), or an explicit hint in the success message that the key was not verified. A completion costs tokens, so this is a trade-off to decide.

Activity

  1. added
    bug
    on Nov 26, 2026
  2. mikemikimike commented on Dec 2, 2026

    @mikemikimike
    Contributor

    Implemented in #1030.

    The connection test now performs a small inference request with the draft model, endpoint and API key, so a public model list cannot produce a successful credential check. It preserves both chat-completions and Responses API handling, stored-key lookup, compatibility retries, cancellation and bounded diagnostics. The UI explains the token usage before running the probe.

    Validation: 146 focused API tests, 23 settings UI tests and 235 documentation tests passed. The PR's backend, frontend, database-provider, desktop, all four Playwright shards, CodeQL and secret-scan checks have also passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions