Skip to content

WP AI Gateway as an opt-in model source for Pi (alongside the Roadie credential pool) #774

Closed

Description

@chubes4

Problem

The optional WP AI Gateway integration only covers OpenCode, which is retired here. Pi, the active Roadie and Homeboy coding runtime, can't use it.

  • lib/ai-gateway.sh: ai_gateway_enabled_for_opencode() returns true only when the runtime is opencode.
  • Setup writes an OpenCode provider.wp-ai-gateway entry and nothing else.
  • Today Roadie-managed Pi runs on Roadie's credential pool (ROADIE_PI_MODEL=roadie/opus in the rendered unit).

Hosts should get a choice of model source for Pi sessions, including sessions behind the WordPress chat platform (#771/#773):

  1. Roadie credential pool (current default): subscription-backed and pooled in Roadie.
  2. WP AI Gateway: the gateway's OpenAI-compatible /wp-json/wp-ai-gateway/v1 endpoint. Upstream keys stay in WordPress, and usage goes through the WordPress AI client. Roadie and Pi hold only a minted gateway token.

Target state

  • --with-ai-gateway applies to Pi.
    • Setup and upgrade write a Pi provider/model entry pointing at the gateway base URL (respect Allow a full WP AI Gateway endpoint override #357's endpoint override if present), with the token from the existing mint/reuse flow.
    • The Roadie unit's Pi model is set to the gateway model.
  • Without the flag, Pi stays on the Roadie credential pool, exactly as today.
  • Keep the existing recursive-topology guard: a gateway route must not point back at the gateway.
  • Remove the retired OpenCode-only gating, or generalize it, rather than adding a parallel path.

Check how Pi reads custom OpenAI-compatible providers (its models/providers config) before choosing the file to write.

Deliverable

A committed change with tests in tests/ai-gateway.sh:

  • Pi with the gateway gets the provider entry and model env.
  • Pi without the gateway keeps the roadie/* model and has no gateway entry.
  • The token is reused across upgrades.
  • The topology guard still holds.

Update the bridge snapshots if the rendered unit changes. CHANGELOG and VERSION are release-owned and stay as they are.

Activity

  1. chubes4 commented on Oct 17, 2026

    @chubes4
    MemberAuthor

    Shipped in #775.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions