Skip to content

Allow selecting provider/model per invocation (e.g. ocr review --provider X --model Y) #680

Description

@nk-tedo-001

Problem Statement

Provider and model are global state in ~/.opencodereview/config.json (ocr config provider / ocr config set model).

To review the same diff with a different model I have to mutate that file, which affects every other run — and concurrent runs race over it.

My flow: I orchestrate reviews from a coding agent. I want to run the same diff through several models (Claude, Codex/GPT, others) via OCR, collect the JSON outputs, deduplicate findings across runs, and post the merged result as comments on a merge request.

Agreement between models is a strong signal for filtering out false positives — but today there is no clean way to vary the model per run.

Proposed Solution

Add per-run flags to ocr review (and ocr scan):

Flag Description
--provider <name> A provider already present in the providers map
--model <name> Model for that provider

Both override config for that invocation only — nothing is written back.

ocr review --from main --to feat --provider anthropic --model claude-opus-4-6 --format json
ocr review --from main --to feat --provider openai    --model gpt-5-codex     --format json

Suggested precedence: flag > env vars > config file.

It would also help if --format json reported which provider/model produced the result, so findings can be attributed during deduplication:

{ "llm": { "provider": "anthropic", "model": "claude-opus-4-6" }, "comments": [] }

Alternatives Considered

  • Env vars (OCR_LLM_URL / OCR_LLM_TOKEN / OCR_LLM_MODEL / OCR_USE_ANTHROPIC) work per process, but bypass the configured providers map - every call has to re-supply URL and token, which is clumsy inside an agent and error-prone in CI.
  • Rewriting config.json between runs - racy under concurrency and destroys the user's own settings.
  • Delegate mode - solves a different problem: one agent, one model, no independent second opinion.

Affected Area

CLI / Commands

Additional Context

Additional Areas: Configuration, Output / Formatting
Related: per-run overrides would also make it easy to benchmark models against each other on a fixed set of diffs, which is useful when picking a default for a team.

Activity

  1. added
    enhancement
    on Aug 2, 2026
  2. added
    good first issue
    help wanted
    on Aug 3, 2026
  3. lizhengfeng101 commented on Aug 3, 2026

    @lizhengfeng101
    Contributor

    Thanks for the well-thought-out proposal, @nk-tedo-001! The use case of running the same diff through multiple models and deduplicating findings is compelling — and the precedence model (flag > env > config) aligns with how we handle --model today.

    We already have --model wired through the resolver, so adding --provider should be fairly straightforward — the main work is threading it into loadLLMRuntime and making the resolver respect it alongside the existing provider map.

    Would you be interested in contributing a PR for this? Happy to point you at the relevant files if that would help.

  4. nk-tedo-001 commented on Aug 3, 2026

    @nk-tedo-001
    Author

    I'll try to give it a chance.

    Thanks for the well-thought-out proposal, @nk-tedo-001! The use case of running the same diff through multiple models and deduplicating findings is compelling — and the precedence model (flag > env > config) aligns with how we handle --model today.

    We already have --model wired through the resolver, so adding --provider should be fairly straightforward — the main work is threading it into loadLLMRuntime and making the resolver respect it alongside the existing provider map.

    Would you be interested in contributing a PR for this? Happy to point you at the relevant files if that would help.

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

    enhancementgood first issuehelp wanted

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions