Skip to content

Fix/gemini cli ref 400 error for opencode - #1413

Closed
dail45 wants to merge 8 commits into
cheaper-inference:mainfrom
dail45:fix/gemini-cli-ref-400-error-for-opencode
Closed

dail45 wants to merge 8 commits into
cheaper-inference:mainfrom
dail45:fix/gemini-cli-ref-400-error-for-opencode

Conversation

@dail45

@dail45 dail45 commented Apr 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Simply changes(add 1 string to array)
  • fix error while using gemini-cli/gemini-any in OpenCode ([400]: Schema.ref 'QuestionOption' was set alongside unsupported fields. If a schema node has Schema.ref set, then only description and default can be set alongside it; other fields they would be replaced by the expanded reference.)

Related Issues

Validation

Simply changes(add 1 string to array)

Tests Added Or Updated

  • List every changed or added automated test file.
  • If no production code changed, state that here.

Coverage Notes

  • If this PR changes src/, open-sse/, electron/, or bin/, explain which tests cover the change.
  • If coverage moved down in any touched file, explain why and what follow-up task will recover it.

Reviewer Notes

  • Call out any risky areas, migrations, feature flags, or manual validation that reviewers should know about.

diegosouzapw and others added 8 commits April 18, 2026 17:17
…1403)

* fix(cloud-code): scope thinking stripping to executor boundaries (cheaper-inference#1401)

* fix(cloud-code): scope thinking stripping to executors

* fix(cloud-code): guard antigravity normalized body

* Update Claude Code obfuscation to version 2.1.114

- Update Claude Code version from 2.1.87 to 2.1.114
- Update X-Stainless-Package-Version from 0.80.0 to 0.81.0
- Add new beta flags: redact-thinking-2026-02-12, advisor-tool-2026-03-01, advanced-tool-use-2025-11-20
- Add missing headers: anthropic-version, anthropic-dangerous-direct-browser-access, x-app, X-Stainless-Timeout
- Add all X-Stainless-* headers (Arch, Lang, OS, Runtime, Runtime-Version, Retry-Count)
- Fix accept-encoding header: identity -> gzip, deflate, br, zstd
- Add connection: keep-alive header
- Update tool name mapping: add lsp, apply_patch, websearch

These changes ensure that requests from OpenCode through Omniroute are indistinguishable from genuine Claude Code 2.1.114 requests, allowing proper authentication with Anthropic's API without triggering extra credits errors.

* fix: resolve CodeQL password hash alert and TruffleHog CI failure

---------

Co-authored-by: Randi <55005611+rdself@users.noreply.github.com>
Co-authored-by: Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com>
Co-authored-by: Nikolay Popov <ekklesio.dev@gmail.com>
Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>
@dail45
dail45 requested a review from diegosouzapw as a code owner April 19, 2026 06:21
@dail45 dail45 closed this Apr 19, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces comprehensive support for Claude Code emulation by implementing header patching, tool remapping, and billing header injection within the base executor. It also centralizes the logic for stripping reasoning and thinking configurations for unsupported models at the executor boundaries. Additional updates include refined release and PR review workflows, security adjustments to file checksum algorithms, and extensive unit test enhancements to address TypeScript strictness. Review feedback highlights a security risk involving a hardcoded device ID, a duplicate section header in the release documentation, and redundant object keys within the test suite.

if (!tb.metadata || typeof tb.metadata !== "object") {
tb.metadata = {
user_id: JSON.stringify({
device_id: createHash("sha256").update("omniroute").digest("hex").slice(0, 24),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The device_id is hardcoded as a static hash of the string "omniroute". This means every installation of OmniRoute will present the same device ID to Anthropic, which significantly increases the risk of account flagging or detection as a proxy. Consider generating a unique, persistent ID per installation or using a random UUID to improve anonymity.

Suggested change
device_id: createHash("sha256").update("omniroute").digest("hex").slice(0, 24),
device_id: createHash("sha256").update(randomUUID()).digest("hex").slice(0, 24),


### 9. Open PR to main

### 9. Open PR to main

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Duplicate section header. This header is already present at line 160.

isModelAvailable: async () => true,
log: createLog(),
settings: null,
relayOptions: null as any,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Adding relayOptions here creates a duplicate key in the object literal, as it is already defined at line 234. This pattern is repeated throughout the file and should be cleaned up by removing the redundant context lines to avoid confusion and maintain clean test code.

This was referenced Apr 30, 2026
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.

Error when using opencode to call gemini-cli model gc/gemini-2.5-pro

3 participants