Skip to content

fix(vercel): list models with the configured API key - #180838

Merged
obviyus merged 2 commits into
mainfrom
fix-vercel-keyed-model-list
Oct 22, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix-vercel-keyed-model-list

Conversation

@obviyus

@obviyus obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

The Vercel AI Gateway plugin fetched /v1/models without the user's API key. Vercel scopes that list per key, so OpenClaw showed the public list (486 models) even when the key can use only a few. A Vercel Token Pass key can call only Token Pass models, so most models in the picker failed with HTTP 403.

Fix

The Vercel catalog now resolves the provider credential and sends it on the model-list request, using the existing live catalog helper (same pattern as Hugging Face). The trusted-proxy fetch guard, the strict discovery mode and the static catalog for unauthenticated reads stay as they are. The provider docs gain a short Token Pass note.

User Impact

openclaw models list --provider vercel-ai-gateway and the model picker show the models the configured key can use. New Vercel models still appear without an OpenClaw release, and model details still come from Vercel's live rows.

Evidence

  • Vercel API, Token Pass key: /v1/models returns 6 models (deepseek/deepseek-v4.1-flash, moonshotai/kimi-k3, zai/glm-5.3 and their -fast variants). Without a key it returns 486.
  • Live run with a real Token Pass key on built OpenClaw: openclaw models list --provider vercel-ai-gateway --all --refresh lists exactly those 6 models, with Vercel status ready. openclaw agent --local turns on zai/glm-5.3 and moonshotai/kimi-k3 replied as expected.
  • Regression test: the catalog run sends Authorization: Bearer <key> on the model-list request. It fails on main (expected null to be 'Bearer scoped-key') and passes with the fix. All 12 Vercel plugin tests pass.
  • Related: fix(vercel): keep Token Pass keys usable after model-scope errors #173750 keeps the key usable after a 403 for a model outside the pass.
  • Follow-up, not in this PR: onboarding still sets anthropic/claude-opus-4.6 as the default, which a Token Pass key cannot use.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: vercel-ai-gateway size: XS labels Oct 22, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR authenticates Vercel model discovery with the configured API key and documents Token Pass model selection.

Example: List Vercel models using a Token Pass key.

  • Before: The author reports 486 public models, including models that reject the key with HTTP 403.
  • After: The author reports six key-scoped models and successful agent turns using zai/glm-5.3 and moonshotai/kimi-k3.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch passes source review; proof confidence is limited to the committed transport regression and the author’s uncaptured live-run report.
Proof confidence 🦐 gold shrimp (3/6) This collaborator-authored PR is outside the ordinary contributor proof gate; its body reports built-CLI catalog refresh and real-key agent turns, while inspectable automated coverage uses a mocked transport.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Token Pass users are offered models that reject their configured key.
Reason: The maintainer-authored change corrects catalog membership through existing provider contracts; onboarding default selection is explicitly separate.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it fixes a current catalog-discovery bug with a focused change, and no introduced correctness defect was found.

Priority: P2
Reviewed head: 4771a4d47d5131e1b27368fe9c9de87ab0f704ce

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Live CLI listing and inference are reported without captured output; the ordinary contributor proof gate is exempt for this maintainer-authored PR.
Agent review details

How this fits together

The Vercel plugin resolves provider credentials and supplies model rows to OpenClaw’s catalog; shared discovery owns HTTP acquisition, credential-scoped caching, and refresh outcomes.

flowchart LR
  A[Model listing and picker] --> B[Vercel catalog hook]
  C[Provider credential resolver] --> B
  B --> D[Shared live discovery]
  D --> E[Guarded Vercel models request]
  E --> F[Model rows and refresh outcome]
  F --> A
Loading

Technical review

Best possible solution:

Use the existing credential resolver and live discovery helper to acquire Vercel’s key-scoped catalog while preserving strict outcomes and offline static listing.

Do we have a high-confidence way to reproduce the issue?

Current main visibly drops discovery credentials before the Vercel model-list request; the author reports the corresponding anonymous-versus-keyed catalog difference, but this review ran no target code.

Is this the best way to solve the issue?

The patch is the smallest complete fix: forward resolved discovery credentials through existing acquisition ownership, with one regression protecting the missing authorization header.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 082e55e28d33.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit d141dc6 adds extensions/vercel-ai-gateway/models.ts:207 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d141dc65ec71; files: extensions/vercel-ai-gateway/models.ts)
  • Peter Steinberger: Raw commit 603f839 adds extensions/vercel-ai-gateway/models.ts:218 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 603f83905888; files: extensions/vercel-ai-gateway/models.ts)
  • Vincent Koc: Raw commit c67bb1c adds extensions/vercel-ai-gateway/provider-catalog.ts:26 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c67bb1c5aafd; files: extensions/vercel-ai-gateway/provider-catalog.ts)

PR surface

Source +13, Tests +18, Docs +9. Total +40 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 18 5 +13
Tests 1 18 0 +18
Docs 1 10 1 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 46 6 +40

Labels

Label changes:

  • add P2: Authenticated catalog discovery currently offers scoped-key users models they cannot call; the repair is limited to the Vercel provider.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Authenticated catalog discovery currently offers scoped-key users models they cannot call; the repair is limited to the Vercel provider.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 22, 2026, 1:55 PM ET / 17:55 UTC.

@obviyus
obviyus merged commit caf1220 into main Oct 22, 2026
112 checks passed
@obviyus
obviyus deleted the fix-vercel-keyed-model-list branch October 22, 2026 18:55
@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as caf1220.

  • Bug: the Vercel plugin fetched /v1/models without the API key, so a Token Pass key saw 486 models but could call 6.
  • Fix: the model-list request now sends the configured key, so Vercel returns the key-scoped list.
  • Proof: a live Token Pass key on built OpenClaw lists exactly its 6 models; the regression test fails on main and passes here.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
## What Problem This Solves

The Vercel AI Gateway plugin fetched `/v1/models` without the user's API key. Vercel scopes that list per key, so OpenClaw showed the public list (486 models) even when the key can use only a few. A Vercel Token Pass key can call only Token Pass models, so most models in the picker failed with HTTP 403.

## Fix

The Vercel catalog now resolves the provider credential and sends it on the model-list request, using the existing live catalog helper (same pattern as Hugging Face). The trusted-proxy fetch guard, the strict discovery mode and the static catalog for unauthenticated reads stay as they are. The provider docs gain a short Token Pass note.

## User Impact

`openclaw models list --provider vercel-ai-gateway` and the model picker show the models the configured key can use. New Vercel models still appear without an OpenClaw release, and model details still come from Vercel's live rows.

## Evidence

- Vercel API, Token Pass key: `/v1/models` returns 6 models (`deepseek/deepseek-v4.1-flash`, `moonshotai/kimi-k3`, `zai/glm-5.3` and their `-fast` variants). Without a key it returns 486.
- Live run with a real Token Pass key on built OpenClaw: `openclaw models list --provider vercel-ai-gateway --all --refresh` lists exactly those 6 models, with Vercel status `ready`. `openclaw agent --local` turns on `zai/glm-5.3` and `moonshotai/kimi-k3` replied as expected.
- Regression test: the catalog run sends `Authorization: Bearer <key>` on the model-list request. It fails on `main` (`expected null to be 'Bearer scoped-key'`) and passes with the fix. All 12 Vercel plugin tests pass.
- Related: openclaw#173750 keeps the key usable after a 403 for a model outside the pass.
- Follow-up, not in this PR: onboarding still sets `anthropic/claude-opus-4.6` as the default, which a Token Pass key cannot use.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Oct 29, 2026
## What Problem This Solves

The repo has no written rules for agents that work on model listing, provider plugins or usage/cost. So the same classes of bugs keep coming back across providers and on the Models and Usage pages.

## User Impact

There is no user-visible change. Agents that work in these areas now get short rules from the scoped guide they already read.

## Why This Change Was Made

Each rule records a lesson that came back 2 or more times in merged work. Each rule is one line, in the guide that owns the area:

- **`src/plugins/AGENTS.md` "Model Listing":**
  - The hot path has no network request.
  - `models.list` has p99 under 300 ms. Rows and prices publish as one snapshot, and removals apply at once.
  - The authenticated listing decides which models show.
  - List with the credential and runtime that will execute the turn, with one row per model per provider.
  - Failed and empty listings each have defined semantics.
  - Capabilities come from the listing, not from model-ID rules.
  - One core admission rule.
- **`extensions/AGENTS.md`:**
  - Host policy that every provider shares stays core.
  - Sign-in goes through the Models page and `/login`. Setup saves the connection only.
  - Native CLIs own their login and model menu.
  - Refusals are classified by cause.
  - Attribution headers come from one helper.
- **`src/agents/AGENTS.md` "Run Authority":**
  - One model resolver for every entry path.
  - No silent fallback to another runtime or billing.
  - Native-runtime consent is asked once.
- **`src/gateway/AGENTS.md` "Usage And Cost" (new section):**
  - Measured, unpriced, partial and unknown usage stay distinct.
  - Each route is priced from the provider that bills it.
  - Reports are complete or flagged as partial.
- **`ui/AGENTS.md`:**
  - A route waits only for its first-paint data.
  - New "Layout Stability" section: zero layout shift, how to prove it, and a 200 ms load budget for Models and Usage.
- **Root `AGENTS.md`:** one line in "Read when relevant" that points to these sections.

Examples of the incidents behind the rules: #140139, #158000, #167444, #167658, #168033, #172608, #172773, #173792, #174641, #176404, #180838, #184066.

## Evidence

- `pnpm check:agents-md-size`: all 27 files are within 20000 chars.
- `oxfmt --check` passes on each of the 6 changed files.
- I checked the cited names on current `main`: `buildLiveModelProviderConfig`, `readModelId` and `modelPricing.providers.<id>.priceAs`.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 29, 2026
…87141)

## What Problem This Solves

The repo has no written rules for agents that work on model listing, provider plugins or usage/cost. So the same classes of bugs keep coming back across providers and on the Models and Usage pages.

## User Impact

There is no user-visible change. Agents that work in these areas now get short rules from the scoped guide they already read.

## Why This Change Was Made

Each rule records a lesson that came back 2 or more times in merged work. Each rule is one line, in the guide that owns the area:

- **`src/plugins/AGENTS.md` "Model Listing":**
  - The hot path has no network request.
  - `models.list` has p99 under 300 ms. Rows and prices publish as one snapshot, and removals apply at once.
  - The authenticated listing decides which models show.
  - List with the credential and runtime that will execute the turn, with one row per model per provider.
  - Failed and empty listings each have defined semantics.
  - Capabilities come from the listing, not from model-ID rules.
  - One core admission rule.
- **`extensions/AGENTS.md`:**
  - Host policy that every provider shares stays core.
  - Sign-in goes through the Models page and `/login`. Setup saves the connection only.
  - Native CLIs own their login and model menu.
  - Refusals are classified by cause.
  - Attribution headers come from one helper.
- **`src/agents/AGENTS.md` "Run Authority":**
  - One model resolver for every entry path.
  - No silent fallback to another runtime or billing.
  - Native-runtime consent is asked once.
- **`src/gateway/AGENTS.md` "Usage And Cost" (new section):**
  - Measured, unpriced, partial and unknown usage stay distinct.
  - Each route is priced from the provider that bills it.
  - Reports are complete or flagged as partial.
- **`ui/AGENTS.md`:**
  - A route waits only for its first-paint data.
  - New "Layout Stability" section: zero layout shift, how to prove it, and a 200 ms load budget for Models and Usage.
- **Root `AGENTS.md`:** one line in "Read when relevant" that points to these sections.

Examples of the incidents behind the rules: openclaw#140139, openclaw#158000, openclaw#167444, openclaw#167658, openclaw#168033, openclaw#172608, openclaw#172773, openclaw#173792, openclaw#174641, openclaw#176404, openclaw#180838, openclaw#184066.

## Evidence

- `pnpm check:agents-md-size`: all 27 files are within 20000 chars.
- `oxfmt --check` passes on each of the 6 changed files.
- I checked the cited names on current `main`: `buildLiveModelProviderConfig`, `readModelId` and `modelPricing.providers.<id>.priceAs`.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: vercel-ai-gateway P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant