Skip to content

Fix upstream Content-Type duplication and provider routing - #14

Merged
jatmn merged 5 commits into
mainfrom
fix/upstream-headers-and-provider-routing
Aug 6, 2026
Merged

Fix upstream Content-Type duplication and provider routing#14
jatmn merged 5 commits into
mainfrom
fix/upstream-headers-and-provider-routing

Conversation

@jatmn

@jatmn jatmn commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Build outbound upstream JSON requests with exactly one Content-Type: application/json header, fixing OpenCode Go streaming 415 errors caused by reqwest appending a duplicate value.
  • Route models by provider prefix (hicap/..., opencode-go/...) and catalog upstream_id aliases so gateway-selected models never fall back to the default provider.
  • Strip provider prefixes when rewriting upstream model IDs (e.g. hicap/grok-4.3grok-4.3).

Test plan

  • cargo test (134 tests pass)
  • Manual: opencode-go/deepseek-v4-flash streaming via warp returns 200
  • Manual: hicap/grok-4.3 and hicap/grok-4.5 return 200 via HiCap API
  • Manual: unknown bare slugs (e.g. grok-4.3) return 502 instead of hitting default provider

@jatmn jatmn self-assigned this Aug 5, 2026
@jatmn jatmn added the bug Something isn't working label Aug 5, 2026
jatmn added 3 commits August 5, 2026 18:30
Build outbound JSON requests with a single application/json header so streaming providers like OpenCode Go stop returning 415, route prefixed and upstream_id model aliases to the intended gateway, and stop falling back to the default provider for unknown models.
@jatmn
jatmn force-pushed the fix/upstream-headers-and-provider-routing branch from 3f9b234 to 40827cf Compare August 6, 2026 01:32
jatmn added 2 commits August 5, 2026 19:05
Only strip provider prefixes when the prefix resolves to the selected gateway so OpenRouter vendor/model slugs stay intact, and return a dedicated 502 message when an explicit model cannot be routed.
Restore single-provider cold-start routing for unlisted slugs while keeping
multi-provider unknown-model 502s; list upstream_id aliases in /models; use
generic no-provider errors for codex-auto-review and empty model fields.
@jatmn
jatmn merged commit 91a60a5 into main Aug 6, 2026
3 checks passed
@jatmn
jatmn deleted the fix/upstream-headers-and-provider-routing branch August 6, 2026 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant