Skip to content

[Feature/UX]: streamline context-window presets/import for /models responses without metadata #1760

Description

@fanqiecd

Area

Catalog / models

What are you trying to accomplish?

I want a quick, reviewable way to supply known context-window values for an OpenAI-compatible relay whose /v1/models response contains model IDs but no context-window metadata. The goal is to populate the existing modelContextWindows fallback without hand-editing JSON for each provider/model, so Codex shows the operator's documented or tested capacity instead of the conservative default.

What prevents this today?

#1073 and the merged PR #1223 already expose and persist contextWindow and modelContextWindows; that solves the underlying configuration mechanism. The remaining problem is discoverability and bulk entry. When live discovery omits context metadata, a newly added relay is shown with the conservative 128K catalog value (about 122K visible in Codex). The operator must know which field to edit and manually update config or open models one by one. There is no clear "metadata not reported" state, reusable preset, or paste/import path.

providerContextCaps is not a substitute: it is a ceiling, while this request is about a user-supplied fallback when the upstream value is unknown.

What should OpenCodex do?

Keep the current contextWindow/modelContextWindows semantics and let the operator choose the value. When /v1/models has no recognized context metadata for one or more rows, provide a non-guessing convenience workflow, for example:

  • show an explicit "context window not reported by provider" status and a quick-fill action in the dashboard (and a comparable CLI/config path);
  • accept a validated JSON map or config fragment for modelContextWindows, matched against discovered model IDs, with a preview before saving;
  • allow saving and reusing a local/provider-scoped preset for newly discovered IDs;
  • label the source of the effective value as upstream-reported, user-supplied fallback, or conservative default.

A minimum useful version could be a banner listing the affected model IDs with a paste/import action. Unknown IDs should be shown for review rather than silently dropped. Explicit user values must survive refreshes and remain easy to clear.

OpenCodex should not infer a capacity from a model name or claim what the upstream service supports. Presets should be operator-provided and clearly marked as such.

Example usage or interface

A relay returns only IDs:

{
  "data": [
    { "id": "gpt-5.6-sol" },
    { "id": "gpt-5.6-terra" }
  ]
}

The dashboard could show:

Context window metadata was not reported for 2 discovered models.
Import a provider preset or enter a fallback map. Values are user-supplied and are not verified against the upstream service.

Pasting the following map would preview and then write the existing configuration field:

{
  "providers": {
    "BLT": {
      "modelContextWindows": {
        "gpt-5.6-sol": 350000,
        "gpt-5.6-terra": 350000
      }
    }
  }
}

The same flow could accept just the map:

{
  "gpt-5.6-sol": 350000,
  "gpt-5.6-terra": 350000
}

The effective catalog would then use those user-supplied fallbacks while preserving the current behavior for models that report authoritative metadata.

Alternatives or workarounds

Additional context

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    catalogModel catalog, slugs, visibility, routed entriesenhancementNew feature or requestproviderProvider adapters, OpenAI-compat presets, upstream API quirksroadmapAccepted long-term work item; needs its own project cycle

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions