Skip to content

OpenRouter migration

BiomAI now uses OpenRouter for PDF and image extraction. Gemini remains the underlying model. JSON, clinical data, exports, public metadata and BiomPIN contracts are unchanged.

  • Replace X-Gemini-API-Key with X-OpenRouter-API-Key and provide an OpenRouter key. Processing explicitly rejects the retired header to stop unintended shared funding.

  • Remove service_tier and CLI --service-tier. Every extraction costs one whole credit. During a grace period, the API accepts and ignores service_tier, regardless of its value. Responses include an X-BiomAPI-Warning header explaining that the parameter is deprecated, has no effect, and will cause requests to be rejected in a future release. Remove it now; no rejection date has been set. The header is not exposed through CORS, so cross-origin browser JavaScript cannot read it.

  • CLI BYOK uses --openrouter-key and OPENROUTER_API_KEY. Stored Google keys are not reused. Browser legacy BYOK values are invalidated.

  • Handle biomai_queue_full separately from daily quota or provider failure. It is an uncharged admission rejection with Retry-After. The web batch uploader waits automatically. API clients should choose their own admission resubmission policy.

  • Do not automatically repeat processing after ambiguous 503/network/timeout outcomes. Another POST can incur another extraction and charge.

  • Read /usage key status from keys.openrouter; keys.gemini was removed. Validation outages return valid: null and validation_error (timeout or unavailable), while confirmed invalid keys return valid: false.

  • Read the configured model from openrouter_model in /status and /health; gemini_llm was removed. /health uses openrouter_api_connected instead of gemini_api_connected for its cached inference check.

Saved historical model provenance remains valid.

Selected BiomAPI keys can temporarily retain assigned direct Vertex access through the operator’s vertex_first policy, with transient fallback to server-default OpenRouter. This does not restore Google BYOK headers or the previous tier/recovery settings. See authentication.