Skip to content

fix(files): accept ?provider= query param on GET /v1/files - #3971

Merged
akshaydeo merged 2 commits into
maximhq:devfrom
alexef:fix/batch-create-model-optional
Jun 3, 2026
Merged

fix(files): accept ?provider= query param on GET /v1/files#3971
akshaydeo merged 2 commits into
maximhq:devfrom
alexef:fix/batch-create-model-optional

Conversation

@alexef

@alexef alexef commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Fixes #3963

Problem

fileList checked ?x-model-provider= as a query parameter name while all other file endpoints (GET /v1/files/{id}, DELETE /v1/files/{id}, etc.) use ?provider=. This meant the standard OpenAI SDK pattern of passing extra_query={"provider": "..."} always failed with a 400 on GET /v1/files.

// before — wrong query param name
provider := string(ctx.QueryArgs().Peek("x-model-provider"))

Fix

Check ?provider= first (consistent with all other file endpoints), then fall back to ?x-model-provider= and the x-model-provider header.

Testing

  • GET /v1/files?provider=openai now accepted
  • GET /v1/files?x-model-provider=openai still works (backwards compatible)
  • x-model-provider header still works

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced request handling to support multiple ways of specifying the model provider parameter with clear precedence order for parameters and headers.

@CLAassistant

CLAassistant commented Jun 2, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ alexef
❌ akshaydeo
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: cd1083d5-9217-4e9c-bdbb-9c176c87bbe6

📥 Commits

Reviewing files that changed from the base of the PR and between 7474c06 and ee0b657.

📒 Files selected for processing (1)
  • transports/bifrost-http/handlers/inference.go

📝 Walkthrough

Walkthrough

The fileList handler in the HTTP inference transport was updated to resolve the provider parameter from multiple sources in a new precedence order: the ?provider query parameter first, then ?x-model-provider query parameter, and finally the x-model-provider header. The validation error message was updated to reflect the new lookup behavior.

Changes

Provider parameter resolution in fileList

Layer / File(s) Summary
fileList provider parameter precedence
transports/bifrost-http/handlers/inference.go
fileList now reads provider from the provider query parameter first, then from x-model-provider query parameter, and finally from the x-model-provider header, bringing consistency to provider resolution across Files API endpoints.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through parameter chains,
First ?provider, then back again,
To x-model-provider if needed be,
One source before the rest, clean and free! 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and accurately describes the main change: accepting the ?provider= query parameter on the GET /v1/files endpoint.
Description check ✅ Passed The PR description includes the linked issue reference, clear problem statement, and the fix explanation with test cases, meeting most template requirements.
Linked Issues check ✅ Passed The PR fixes issue #3963 by implementing the exact requirement: making GET /v1/files check ?provider= first while maintaining backward compatibility with ?x-model-provider=.
Out of Scope Changes check ✅ Passed All changes are focused on the fileList request handling in the inference handler, directly addressing the linked issue with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

This is a safe, minimal change that restores the correct query-parameter name for a single handler.

The change is a one-function fix that makes fileList consistent with every other file-endpoint handler in the same file. The fallback chain (?provider=?x-model-provider=x-model-provider header) is backwards-compatible and matches the pattern used by fileUpload. No shared state, no concurrency implications, and no downstream behaviour is affected beyond the corrected parameter lookup.

No files require special attention.

Important Files Changed

Filename Overview
transports/bifrost-http/handlers/inference.go Fixes fileList to accept ?provider= first (matching all other file endpoints), then falls back to ?x-model-provider= and the x-model-provider header for backwards compatibility; error message updated accordingly.

Reviews (3): Last reviewed commit: "Merge branch 'dev' into fix/batch-create..." | Re-trigger Greptile

GET /v1/files was only checking ?x-model-provider= as a query parameter,
while all other file endpoints use ?provider=. This forced clients to use
the non-standard header form even when calling via the OpenAI SDK with
extra_query={"provider": "..."}.

Now accepts ?provider= first (consistent with other endpoints), then falls
back to ?x-model-provider= and the x-model-provider header.

Fixes maximhq#3963

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@alexef
alexef force-pushed the fix/batch-create-model-optional branch from 4a4df90 to 6906431 Compare June 2, 2026 03:57
@alexef alexef changed the title fix(batch): make model optional on POST /v1/batches; fix ?provider= on GET /v1/files fix(files): accept ?provider= query param on GET /v1/files Jun 2, 2026
@akshaydeo
akshaydeo changed the base branch from main to dev June 3, 2026 10:18
@akshaydeo
akshaydeo merged commit 6cffac7 into maximhq:dev Jun 3, 2026
3 of 5 checks passed
akshaydeo added a commit that referenced this pull request Jun 4, 2026
GET /v1/files was only checking ?x-model-provider= as a query parameter,
while all other file endpoints use ?provider=. This forced clients to use
the non-standard header form even when calling via the OpenAI SDK with
extra_query={"provider": "..."}.

Now accepts ?provider= first (consistent with other endpoints), then falls
back to ?x-model-provider= and the x-model-provider header.

Fixes #3963

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Akshay Deo <akshay@akshaydeo.com>
@akshaydeo akshaydeo mentioned this pull request Jun 7, 2026
akshaydeo added a commit that referenced this pull request Jun 7, 2026
GET /v1/files was only checking ?x-model-provider= as a query parameter,
while all other file endpoints use ?provider=. This forced clients to use
the non-standard header form even when calling via the OpenAI SDK with
extra_query={"provider": "..."}.

Now accepts ?provider= first (consistent with other endpoints), then falls
back to ?x-model-provider= and the x-model-provider header.

Fixes #3963

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Akshay Deo <akshay@akshaydeo.com>
akshaydeo added a commit that referenced this pull request Jun 7, 2026
## ✨ Features

- **OpenAI Compaction** — Added OpenAI conversation compaction support
across core, framework, logging, and the API surface (#4053)
- **Multi-Customer & Org Hierarchy** — Logs and usage tracking now
support multiple customers, teams, and business units, including
business unit CRUD, team assignment, and governance endpoints in the
OpenAPI spec (#4066, #4041, #4082)
- **Provider-Level Governance** — Budgets & limits are now scope-aware
and can be applied at the virtual-key top level and per provider, wired
from the model configs table, with UI filters for scope and providers
(#3938, #3937, #3939, #3981, #3962)
- **Customer Budgets** — Customers support multiple budgets and
`calendar_aligned` budget windows (#3998, #3997)
- **Virtual Key Attribution & Controls** — Added a `created_by` user
attribution column and a `blacklisted_models` column for virtual key
provider configs (#3672, #3653)
- **Request Header Capture** — OTel and Maxim observability plugins
capture `request_headers` by pattern, with wildcard support (e.g.
`x-custom-*`); logging gained the same wildcard header capture (#4012,
#3958)
- **OTel Content Controls & Collectors** — New `disable_content_logging`
option drops message/tool content from exported spans, plus support for
multiple OTel collectors (#4064, #3894)
- **xAI x_search** — Added xAI `x_search` tool support (#3976)
- **URL Validation** — Added fetch URL validation with private-network
configuration and link-local blocking (#3947, #3991)
- **File Scheme Pricing URLs** — Pricing source URLs now accept the
`file://` scheme for air-gapped and self-hosted deployments (#4045)
- **Paginated Virtual Keys** — Virtual key fetching is paginated to
handle deployments with very large numbers of keys (#3957)
- **Client IP Resolution** — Resolve client IP from
`X-Forwarded-For`/`X-Real-IP` headers
- **SCIM Provisioning** — Added `attributeType`/`attributeValue` SCIM
provisioning fields
- **Helm/Config Schema** — Added `roles` RBAC governance config and
`per_user_oauth` MCP auth to the Helm chart and config schema (#4004,
#4009)
- **Log Navigation UI** — Added a "View logs" menu item to customer,
team, and virtual key tables, clickable links in log detail views, a
customer detail sheet, and a reusable `BudgetDisplay` component (#4073,
#4054, #4026, #4055)
- **Faster First Paint** — Added an inline loading shell to `#root`
before React mounts (#4063)
- **Materialized View Alias** — Added an `alias` column to the
materialized view with filter support (#4078)

## 🐞 Fixed

- **Fetch URL IP Checks** — Hardened fetch URL IP checks against SSRF
(#4092)
- **Mantle Model Matching** — Broadened Mantle model matching to all
`gpt` variants (#4091)
- **Empty Thinking Blocks** — Strip thinking blocks when the signature
is empty (#4079)
- **OpenAI Stream Usage** — Removed usage from the `responses.created`
event in the OpenAI stream (#4080)
- **Prompt Cache Key** — Set the prompt cache key from the Anthropic
integration (#4086)
- **Upstream Failure Status** — Map upstream connection failures to 502
instead of 400 (#3929) (thanks
[@chris-colinsky](https://github.com/chris-colinsky)!)
- **Gemini Schema Constraints** — Accept numeric schema integer
constraints for Gemini (#3994) (thanks
[@yanhao98](https://github.com/yanhao98)!)
- **Files Provider Param** — Accept the `?provider=` query param on `GET
/v1/files` (#3971) (thanks [@alexef](https://github.com/alexef)!)
- **Optional Batch Model** — Made the `model` field optional on `POST
/v1/batches` (#3973) (thanks [@alexef](https://github.com/alexef)!)
- **Helm Azure Config** — Added missing `azure_key_config` fields to the
Helm schema (#3996) (thanks
[@axelray-dev](https://github.com/axelray-dev)!)
- **Text Completion Chunk Model** — Added the missing `Model` field to
`TextCompletionChunkResponse` (#3970) (thanks
[@kuishou68](https://github.com/kuishou68)!)
- **MCP Inline stdio Env** — MCP stdio server configs accept inline
environment variable assignments (#3861) (thanks
[@Shushmitaaaa](https://github.com/Shushmitaaaa)!)
- **Orphaned Tool Results** — Orphaned tool results in the OpenAI to
Anthropic conversion flow are no longer rejected by the Anthropic API
(#3919)
- **Node Usage Reconciliation** — Added a monotonic `inc_number` log
cursor so node usage reconciliation does not skip late async log writes
(#3664)
- **Bedrock Output Assessments** — Corrected the type of
`outputAssessments` in Bedrock responses (#4028)
- **Model Pool Pricing Reloads** — Preserve non-pricing model pool
entries across pricing reloads (#3999)
- **Ghost Node Reconciliation** — Replicate the VK hierarchy flow for
ghost node reconciliation (#4088)
- **VK Double Usage Counting** — Fixed double usage counting when
creating a virtual key (#4070)
- **Model Config Lifecycle** — Cascade deletes for model configs and
removal of stale in-memory model configs (#4051, #4043)
- **FTS Index Cap** — Reduced the FTS index `left()` cap from 800k to
250k chars to stay within the tsvector limit (#4057)
- **Sync Worker Drift** — Reduced the sync worker ticker period to 5m to
prevent threshold drift (#4023)
- **Passthrough** — Fixed passthrough budgets, gated passthrough models
per VK, model extraction for Azure passthrough, and restricted
fallbacks/provider selection to the VK boundary (#3941, #3988, #3983,
#3924)
- **Provider Response Headers** — Strip provider response headers and
add a content-type filter (#3955, #4024)
- **Stream Handling** — Drain non-SSE stream readers and retry stale
connections (#3956, #3967)
- **Azure Claude** — Strip Azure diagnostic property for Claude models
(#3925)
- **Compat max_tokens** — Preserve chat `max_tokens` during param
filtering (#3992)
- **Raw Request Flag** — Removed the raw request flag from providers
that don't support it (#4058)
- **UI Fixes** — Standardized page container layout, virtual key model
configs UI, and dashboard chart tooltips (#4046, #4052, #4044)

## 🔧 Maintenance

- **Dependency Upgrades** — Bumped transitive `golang.org/x`
dependencies (crypto, net, sys, text) for Docker Scout CVE remediation
and `recharts` to 3.8.1; cascaded version bumps across all modules
(#3900, #4003)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Files list endpoint ignores provider query parameter and requires x-model-provider

3 participants