Skip to content

gemini provider: Google's Decisions API (gemini-decision-1) - #11

Merged
FMXExpress merged 1 commit into
mainfrom
gemini-provider
Nov 14, 2026
Merged

FMXExpress merged 1 commit into
mainfrom
gemini-provider

Conversation

@FMXExpress

@FMXExpress FMXExpress commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner
[decider]
provider = gemini      ; key in api_key = or GEMINI_API_KEY

Google's Decisions API asks the same kind of questions jevban already sends (noul per client, optional choice for intent) and returns the same answer shape (answers.<key>.noul, a calibrated probability between 0.01 and 0.99). Only the wire format differs. Details below were checked verbatim against the documentation:

System One Decisions API
Endpoint, model /v1/systemone generativelanguage.googleapis.com/v1beta/decisions, gemini-decision-1
Context state (JSON object) input (text): the same state, as JSON
noul criteria true / false true_description / false_description
Auth Authorization: Bearer x-goog-api-key

api = gemini in [decider] selects the Gemini format for a proxy in front of the service.

Results on the real service (free tier)

These are held-out test splits plus the real LogarX log, on the same build. No benign client was banned by Gemini in any run. Full notes are in bench/results/iter9-gemini/README.md.

Split Rules alone Gemini OpenJev Flash 9B (local) Benign banned (Gemini / Flash) Wall clock (Gemini / Flash)
WordPress 44/51 46/51 47/51 0 / 0 128 s / 26 min
Static site 48/52 49/52 49/52 0 / 1 18 s / 7.5 min
Web app 43/51 44/51 44/51 0 / 0 100 s / 12 min
LogarX (real) 126/126 126/126 — 0 / — 153 s / —

On every split Gemini let fewer attack requests through than the rules: 196 → 175, 170 → 160, 216 → 214, and 536 → 457 on LogarX.

What Gemini adds over the rules: two password guessers on WordPress and one stealth scanner each on the static site and the web app. Flash banned one benign uptime monitor on the static site: five separate verdicts at 0.80–0.84 on GET / 200 with a Go-http-client agent. That's recorded here, and a guard against it is separate work.

Changes from the first version of this PR

  • Its own thresholds. Gemini's probabilities for some real attackers sit at 0.57–0.79, under the 0.80 jevban sets for OpenJev. At 0.80 it added one attacker and lost one. The preset now strikes at 0.50 and logs REVIEW from 0.30, unless the config sets threshold or review_threshold itself.
    • These values were chosen on the dev splits: no benign client scored above 0.26 there (80 judged), while most attackers scored 0.8–0.99. The test splits were then run once at these settings.
    • On LogarX, 22 clients fell in the REVIEW band (p 0.30–0.47): 3 reconnaissance attackers and 19 benign clients. None was banned.
  • HTTP 429 is waited out instead of falling back to the rules.
    • On the free tier (50,000 input tokens a minute), the first run sent 18–111 batches per split to the rules this way.
    • Retries now wait as long as the provider says ("retry in 19s", or the retryDelay field; 10 s if neither), up to 6 times, in steps that shutdown interrupts. With retries there were 0 errors.
    • This applies to every provider. The mock can simulate it (MOCK_429=N).
  • Safety blocks are retried one client at a time. The Decisions API refuses a whole request when any of its text trips its filter. A client can write such text into its user agent and send every client in its batch to the rules. A refused batch is now asked again per client; a client refused on its own goes to REVIEW at 0.5.
  • A latent config bug fixed: the flags for "url, model and thresholds were set in the config" weren't initialized when there was no config file.

Tests

  • Mock server: tests/mock_jev.py serves /v1beta/decisions and rejects what the documentation says the service rejects (unknown fields or state instead of input, a missing key, wrong noul criteria names, bad question keys). It also returns the documented safety-block and 429 responses.
  • CI: jevban runs against the mock with provider = gemini; the System One run is unchanged.
  • Unit tests: 191 checks, 0 failed. The new ones cover the request shape, retry delays, and preset thresholds (that config values win, and that other presets keep jevban's).

🤖 Generated with Claude Code

https://claude.ai/code/session_01NPVFJFY41846T15QqxmGW2

The same questions over its request shape: the client state as the input
text, noul criteria as true_description/false_description, the key in
x-goog-api-key; answers parse as before. api = gemini selects the shape for
a proxy. A batch refused by its safety filter (a client can write such text
into its user agent to send its batchmates to the rules) is asked again one
client at a time; a client refused alone goes to REVIEW at 0.5.

The mock now serves /v1beta/decisions and rejects what the documentation
says the service rejects; CI runs jevban against it. Not yet run against the
service itself (needs a key).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NPVFJFY41846T15QqxmGW2
@FMXExpress
FMXExpress merged commit 23ca28f into main Nov 14, 2026
2 checks passed
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.

2 participants