Skip to content

Local API reference

The localhost API exposed by the embedded Diffgazer server.

The API documented here is the local API used by the Diffgazer web app. It is not a hosted public API and it is not meant to be deployed as a standalone internet service.

In web mode, the diffgazer CLI starts the embedded server, serves the browser app, and keeps both on the same localhost origin. DIFFGAZER_SHUTDOWN_TOKEN enables the API gate in every mode. Packaged runs require the x-diffgazer-shutdown-token header for API access outside health checks and preflight requests.

Health

MethodPathPurpose
GET/healthServer health check mounted at the root router.
GET/api/healthServer health check mounted under /api.

Health responses are lightweight and do not require repository trust.

V2 configuration actions

POST /api/config/actions is the only configuration write route. It accepts the six generic configuration actions as a discriminated union on action, requires repository trust, and rejects bodies over the shared request size limit. Every response is a client-safe summary: configuration identity, readiness, notices, remediation, and available actions. Literal secrets, environment values, auth paths, and raw diagnostics are never returned.

ActionPurpose
createCreate a new configuration for a selectable product.
inspectRead the current safe summary and readiness evidence.
selectPin an exact admitted model, optionally with the product endpoint that model bills against, and make that configuration the selected one.
testRun the readiness and conformance probe for the configured tuple, which is also how models are discovered.
updateUpdate endpoint, credential reference, or notice acknowledgement.
deleteDelete the configuration after active review leases drain.

Every response carries an operation status of succeeded or failed, plus the optional safe projection. A revision conflict is not a response body status: it is an HTTP 409 error envelope with the CONFIGURATION_CONFLICT code. Example shape without secrets:

json
{
  "status": "succeeded",
  "configuration": {
    "configurationId": "cfg-example",
    "revision": 1,
    "status": "supported",
    "transportFamily": "hosted-api",
    "productId": "gemini",
    "endpoint": "https://generativelanguage.googleapis.com/v1beta",
    "selectedModelId": "gemini-2.5-pro",
    "notices": [],
    "availableActions": ["inspect", "select", "test", "update", "delete"]
  },
  "readiness": {
    "status": "ready",
    "ready": true,
    "evidenceStatus": "passed",
    "checkedAt": "2026-01-01T00:00:00.000Z",
    "acknowledgement": {
      "status": "accepted",
      "noticeId": "gemini-hosted-api",
      "noticeVersion": 1,
      "acceptedAt": "2026-01-01T00:00:00.000Z"
    },
    "action": "inspect",
    "explanation": "The exact configured review path is ready.",
    "remediation": {
      "code": "none",
      "message": "No remediation is required."
    }
  }
}

Readiness may also report skipped. A skipped live probe is evidence only and never enables a product. Remediation code enable-live-probe means the configuration must be tested again after prerequisites are satisfied.

create accepts an optional acknowledgement of the product's current notice and update requires one; a record without an accepted current notice reports acknowledgement-required ahead of any conformance verdict, and starting a review on it is refused with 503 SETUP_REQUIRED. The UIs send the acknowledgement automatically once the global provider consent is recorded in settings.providerConsent (see configuration).

The only other config routes are reads:

MethodPathPurpose
GET/api/config/initResolve initial setup state for the current project.
GET/api/config/providersList client-safe product metadata and saved configuration summaries.
GET/api/config/providers/:configurationId/modelsReturn the admitted model catalog for one saved configuration.

A passed models response carries source and cached describing where the list came from: live, cache, or snapshot mean the models.dev catalog (a fresh fetch, the hourly disk cache, or the bundled snapshot); provider-live or provider-cache mean the product's own model list supplied the ids — OpenRouter's and Ollama Cloud's public lists, or {endpoint}/models asked with the configuration's own credential for Z.AI, DeepSeek, Qwen International, Moonshot Open Platform, MiniMax International, and OpenCode Zen, and {endpoint}/openai/models for Google Gemini — with models.dev supplying names and prices for the ids it also knows; an id it does not know yet keeps tier: "unknown" and a description reading "Pricing unknown". cached is true exactly for cache and provider-cache. See Privacy for what each request carries.

For a product whose endpoints are billing pools — OpenCode Zen and OpenCode Go — the response is the union of both pools, so a provider-* source describes the bound pool's list only: rows that just the other pool serves come from the models.dev catalog and carry the bound pool's fetchedAt alongside it. Each row's endpointProfileIds names the endpoint profiles observed to serve it: a row served by one pool bills that pool, while a row both pools serve bills the pool tab active when the model is confirmed — that is the pool select carries.

There is no per-provider activate or delete route. GET …/models is the picker read path; test also discovers models as part of readiness probing. select both pins the exact model and makes that configuration the globally selected one. Its optional endpoint moves the configuration to the other billing pool of the same product — the pool the chosen model runs on — and is accepted only when it is the bound or sibling endpoint of that configuration's own pool, which today means OpenCode Zen and OpenCode Go. Every other endpoint is rejected with INVALID_ACTION, including the second endpoint of a product whose endpoints are separate accounts rather than pools, such as Moonshot Open Platform's other region. Omitting it leaves the endpoint alone. Either way select keeps the revision, so the credential binding survives; the conformance evidence is cleared as it already is on every model change.

Settings and trust

MethodPathPurpose
GET/api/settingsRead local UI and runtime settings.
POST/api/settingsPatch local settings, including providerConsent.
GET/api/settings/trustRead trust for the current project.
POST/api/settings/trustSave trust for the current project.
DELETE/api/settings/trustRemove trust for the current project.

Trust routes always require the shutdown token and fail closed when it is missing.

Git

MethodPathPurpose
GET/api/git/statusRead git status for the current repository.
GET/api/git/diff?mode=unstagedRead unstaged diff.
GET/api/git/diff?mode=stagedRead staged diff.

Git routes require repository trust.

Review

MethodPathPurpose
POST/api/review/reviewsCreate and start a review. A configuration whose only open item is structured-output conformance is admitted and verified by the review itself; once a tuple has failed structured output the route answers 403 / SETUP_REQUIRED immediately, without contacting the provider. A start that collides with a review already holding the configuration's concurrency answers 409 / REVIEW_IN_PROGRESS. A diff past the selected model's context window is refused at create time with the estimate and the window in the message; a diff that fits but is large starts the review and reports a review_size_warning event on the stream.
GET/api/review/reviews/:id/streamResume or replay a review event stream.
GET/api/review/sessions/activeRead the active review session for a diff mode.
DELETE/api/review/sessions/:idCancel an active review session.
GET/api/review/contextRead current review context.
POST/api/review/context/refreshRefresh review context.
GET/api/review/reviewsList saved reviews.
GET/api/review/reviews/:idRead one saved review.

Saved reviews persist an immutable execution snapshot, normalized usage when available, and one terminal outcome:

OutcomeMeaning
completedReview Completed — schema-valid findings were produced.
cancelledReview Cancelled — the run stopped before completion.
timed-outReview Timed Out — a time limit was exceeded.
transport-failedTransport Failed — the admitted transport could not finish.
schema-failedSchema Validation Failed — output did not match the review schema.
budget-exhaustedBudget Exhausted — a configured budget limit was reached.

Findings are carried by completed, budget-exhausted, and cancelled outcomes only — a cancelled run keeps the partial findings its lenses produced before it was stopped, written by the cancel and shutdown drain. Every other failed outcome carries none. Receipts and usage summaries are client-safe and contain no secrets.

Shutdown

MethodPathPurpose
POST/api/shutdownAsk the embedded server to terminate the CLI process gracefully.