Skip to content

Model picker loses provider/origin prefix for OmniRoute models after /v1/models update #29

Description

@andeerc

Summary

After upgrading OmniRoute, OpenCode's model picker started showing OmniRoute models without their provider/origin prefix.

The models are routed correctly, but the selector now displays only the friendly name, for example:

Big Pickle
DeepSeek V4 Flash Free

Instead of a provider-aware label such as:

OpenCode Free / Big Pickle
oc / Big Pickle
OpenCode Free / DeepSeek V4 Flash Free
Image

This makes it hard to identify where a model comes from when OmniRoute exposes multiple upstream providers through the same OpenCode provider entry.

Why this seems related to the plugin

OmniRoute's /v1/models response contains the origin information in fields like id, owned_by, parent, and root.

Example response:

{
  "id": "oc/big-pickle",
  "object": "model",
  "owned_by": "opencode",
  "root": "big-pickle",
  "parent": null,
  "family": "big-pickle",
  "name": "Big Pickle"
}

And also an alias:

{
  "id": "opencode/big-pickle",
  "object": "model",
  "owned_by": "opencode",
  "root": "big-pickle",
  "parent": "oc/big-pickle",
  "family": "big-pickle",
  "name": "Big Pickle"
}

The problem is that the model picker appears to use model.name directly. Since the name field is only "Big Pickle", the origin is lost in the UI.

Current behavior

In OpenCode /models, the selector shows:

OmniRoute

Big Pickle
Big Pickle
DeepSeek V4 Flash Free

The provider/origin is not visible, even though the model IDs are namespaced:

oc/big-pickle
opencode/big-pickle
oc/deepseek-v4-flash-free

Expected behavior

The plugin should preserve or expose provider/origin information in the displayed model name.

Possible expected display:

OmniRoute

OpenCode Free / Big Pickle
OpenCode / Big Pickle
OpenCode Free / DeepSeek V4 Flash Free

Or shorter:

oc / Big Pickle
opencode / Big Pickle
oc / DeepSeek V4 Flash Free

Suggested fix

Add an option to prefix model names with their namespace/provider when fetching models from OmniRoute.

Example config:

{
  "provider": {
    "omniroute": {
      "options": {
        "prefixModelNameWithProvider": true
      }
    }
  }
}

Suggested transformation:

function getModelOrigin(model: any): string | undefined {
  if (model.id?.includes("/")) {
    return model.id.split("/")[0];
  }

  if (model.owned_by) {
    return model.owned_by;
  }

  return undefined;
}

function getDisplayName(model: any, options: any): string {
  const baseName = model.name || model.id;

  if (!options.prefixModelNameWithProvider) {
    return baseName;
  }

  const origin = getModelOrigin(model);

  if (!origin) {
    return baseName;
  }

  return `${origin} / ${baseName}`;
}

Optionally map known namespaces to nicer labels:

const providerLabels: Record<string, string> = {
  oc: "OpenCode Free",
  opencode: "OpenCode",
  openrouter: "OpenRouter",
  anthropic: "Anthropic",
  openai: "OpenAI",
  google: "Google",
  gemini: "Google",
  cx: "Codex",
  antigravity: "Antigravity"
};

function getPrettyOrigin(origin: string): string {
  return providerLabels[origin] ?? origin;
}

Then display:

return `${getPrettyOrigin(origin)} / ${baseName}`;

Possible alias deduplication issue

The API can return both:

oc/big-pickle
opencode/big-pickle

Where one model has:

"parent": null

And the alias has:

"parent": "oc/big-pickle"

It may also be useful to add an option to hide aliases:

{
  "provider": {
    "omniroute": {
      "options": {
        "hideModelAliases": true
      }
    }
  }
}

Suggested behavior:

const visibleModels = options.hideModelAliases
  ? models.filter((model) => !model.parent)
  : models;

Reproduction

  1. Upgrade OmniRoute to a recent version.
  2. Enable/connect OpenCode Free provider in OmniRoute.
  3. Configure OpenCode with opencode-omniroute-auth.
  4. Open OpenCode.
  5. Run:
/models
  1. Look at the OmniRoute model group.

Actual result

Models appear without their origin:

Big Pickle
Big Pickle
DeepSeek V4 Flash Free

Expected result

Models should include origin/provider information:

OpenCode Free / Big Pickle
OpenCode / Big Pickle
OpenCode Free / DeepSeek V4 Flash Free

Environment

  • OS: Windows 11 and Ubuntu 24.12
  • OpenCode version: 1.16.2
  • OmniRoute version: 3.8.13
  • opencode-omniroute-auth version: latest

OmniRoute /v1/models sample

{
  "id": "oc/big-pickle",
  "object": "model",
  "created": 1780920266,
  "owned_by": "opencode",
  "permission": [],
  "root": "big-pickle",
  "parent": null,
  "capabilities": {
    "vision": false,
    "tool_calling": true,
    "reasoning": true,
    "thinking": true,
    "attachment": false,
    "structured_output": true,
    "temperature": true
  },
  "input_modalities": ["text"],
  "output_modalities": ["text"],
  "context_length": 200000,
  "max_output_tokens": 32000,
  "max_input_tokens": 160000,
  "family": "big-pickle",
  "knowledge_cutoff": "2025-01",
  "release_date": "2025-10-17",
  "last_updated": "2025-10-17",
  "open_weights": false,
  "name": "Big Pickle"
}
{
  "id": "opencode/big-pickle",
  "object": "model",
  "created": 1780920266,
  "owned_by": "opencode",
  "permission": [],
  "root": "big-pickle",
  "parent": "oc/big-pickle",
  "family": "big-pickle",
  "name": "Big Pickle"
}

Notes

This started happening after upgrading OmniRoute. It may be related to recent OmniRoute changes that made OpenCode Free/no-auth models visible in /v1/models, but the actual display issue seems to be in how the OpenCode plugin maps OmniRoute model metadata into OpenCode's model picker.

The model ID is correct and routing works. The issue is only the displayed model label.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions