mark3labs / mark3labs/kit

fix: recognize openrouter/auto during model lookup

Open Beginner friendly
#138 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
134
Forks
24
Avg merge
8h 59m
Merged PRs (30d)
23

Description

Bug Description

Kit emits a misleading warning for the valid OpenRouter auto-routing model:

Warning: model "auto" not found in model database for provider openrouter. Similar models: openrouter/auto

openrouter/auto is listed by kit models openrouter and is a valid OpenRouter model selector. The warning is cosmetic—the request is still passed through—but it suggests that the configured model is invalid and recommends the exact same model with its provider prefix.

Steps to Reproduce

  1. Configure Kit with KIT_MODEL=openrouter/auto (or pass the equivalent model configuration).
  2. Run Kit with a valid OPENROUTER_API_KEY.
  3. Observe the startup warning.

The warning also reproduces with the v0.105.0 binary. The same lookup logic appears in v0.107.0.

Relevant Code / Configuration

model: "openrouter/auto"

The model database entry is structured approximately as:

{
  "openrouter": {
    "models": {
      "openrouter/auto": {
        "id": "openrouter/auto"
      }
    }
  }
}

But CreateProvider parses the configured value into provider openrouter and model name auto, then calls:

registry.LookupModel("openrouter", "auto")

LookupModel indexes directly with the bare model name:

modelInfo, exists := providerInfo.Models[modelID]

That misses the database key openrouter/auto, causing the warning and the self-referential suggestion.

Affected Component

Model database lookup / OpenRouter provider

Kit Version

v0.105.0 (installed binary); the same code path is present in v0.107.0.

Additional Context

Possible fixes include either:

  • normalizing model database keys for the openrouter provider to bare model names when building the registry; or
  • making LookupModel try the provider-qualified key (provider + "/" + modelID) after the bare key.

The latter should preserve the current behavior for providers whose model keys are already bare. A regression test for LookupModel("openrouter", "auto") would help prevent this from recurring.

The provider still works because the model database is advisory, so this does not block requests; it only produces an incorrect warning and prevents metadata-based handling for this model.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at registry.LookupModel and the CreateProvider call path described in the issue, then inspect how provider model keys are stored and matched. Add coverage for LookupModel("openrouter", "auto") and verify that the valid model no longer produces the misleading warning while existing bare-key providers still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
ai, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.