Skip to content

model/openai: support provider-scoped context window resolution #2360

Description

@Rememorio

Problem

OpenAI-compatible providers can expose the same model name with different context windows. Registering provider-specific values in the process-wide model-name registry makes one provider silently affect another.

Proposal

Add an OpenAI model option that accepts a provider-scoped context-window resolver. A positive explicit WithContextWindow value remains authoritative; otherwise the resolver may supply provider metadata, and unresolved names continue to use the existing model-name registry fallback.

This keeps existing callers unchanged while letting provider adapters avoid global model-name collisions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions