Skip to content

[Bug]: Pi export emits invalid IDs for nested provider model slugs #8172

Closed

Description

@huenchunb

Client or integration

Other — Pi using the OpenCodex-exported provider

Area

Catalog / models

Summary

The Pi catalog export changes OpenRouter's nested model ID openrouter/free into openrouter-free. Pi then sends a selector the proxy cannot route and OpenRouter rejects with HTTP 400. Sending the canonical selector with the nested slash works.

Reproduction

  1. Configure the OpenRouter provider in OpenCodex and enable the router model ID openrouter/free.
  2. Start OpenCodex with ocx start --port 10100 and request GET http://127.0.0.1:10100/v1/models. Confirm the model is exposed as openrouter/openrouter/free (provider namespace plus the full upstream slug).
  3. Run ocx export --client pi --json and inspect providers.opencodex.models. The row is exported with id: openrouter/openrouter-free and name openrouter/free (openrouter).
  4. Send a Chat Completions request to http://127.0.0.1:10100/v1/chat/completions with model: openrouter/openrouter-free. The proxy returns HTTP 400 with Provider error 400: openrouter/openrouter-free is not a valid model ID.
  5. Send the same request with model: openrouter/openrouter/free. It succeeds and the response identifies a concrete :free model. This demonstrates that the exported ID changes the upstream selector.

Version

OpenCodex 2.94.0

Operating system

macOS 26.7.1

Provider and model

OpenRouter / openrouter/free

Logs or error output

Provider error 400: openrouter/openrouter-free is not a valid model ID

Redacted configuration

Pi's generated models.json contains the provider opencodex; its OpenRouter row has ID openrouter/openrouter-free. The OpenRouter credential is configured in OpenCodex and is intentionally omitted.

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Related pull request

Fix proposed in #8171: the Pi serializer preserves the canonical provider/model selector, including nested upstream slashes. It leaves synthetic Fast selectors and other client serializers unchanged, adds regression coverage, and updates the Pi and architecture documentation. The PR targets dev.

Activity

  1. github-actions commented on Nov 4, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: English.

  2. added
    bug
    catalog
    on Nov 4, 2026
  3. github-actions commented on Nov 4, 2026

    @github-actions
    Contributor

    Potential duplicates found:

    Reason: Issue 8168 reports the same root cause: the Pi catalog export rewrites the nested OpenRouter slug 'openrouter/free' into the invalid ID 'openrouter-free', causing the upstream to reject the model with HTTP 400, identical to the new issue's

    Detected automatically via GitHub Copilot; automatic closure requires separate deterministic evidence.

  4. coderabbitai commented on Nov 4, 2026

    @coderabbitai
    Contributor
    ⚠️ Possible Duplicate Issue(s)
    🔗 Related PRs

    #7971 - fix(router): decode routed slugs via modelDisplayNames ids [open]
    #7979 - fix(router): decode routed slugs via modelDisplayNames ids [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  5. lidge-jun commented on Nov 7, 2026

    @lidge-jun
    Owner

    The straightforward Pi-only selector rewrite needs an owner routing-design decision before it is safe to merge. Independent review found that acme/org/model can select the distinct native model acme/org/model instead of the intended org/model when both exist; the router gives the full native ID precedence. The draft #8287 head has that regression and must remain unmerged.

    A local guard that requires the encoded and raw selectors to resolve to the same concrete identity avoids that collision when its configuration is authoritative, but two clean synthetic tests still fail: a live-only model with a cold local inventory keeps the broken encoded selector, and a CLI using saved inventory can approve a raw selector that routes to a different model in the serving proxy's newer inventory. Encoded collisions and synthetic Fast selectors also need an explicit policy.

    Owner decision needed: where the serving proxy should establish and carry selector identity for CLI export and managed integration refresh, and how to handle cold or ambiguous encoded selectors and their Fast rows without silently selecting another model or changing endpoint/admission behavior. The issue remains open; #8287 stays draft pending that decision.

  6. added a commit that references this issue on Nov 12, 2026
    7ce7d5a
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

    bugcatalog

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions