Add /enhance path to openapi.yaml (wave-gateway#799) - #44
Conversation
The live-bound POST /v1/enhance route (ESPCN super-resolution, v1 ships exactly one model) had no OpenAPI entry. Documents auth (bearer key, enhance:write scope), the x402 402 challenge for unauthenticated callers (mirrors the Render/MoQ PaymentRequired idiom), the raw-body-or-?url= input contract, the per-job receipt headers (x-enhance-*), the wave_enhance_minutes duration-billing note, and the 400/413/422/501/503 error shapes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_9a7d1ce7-336e-40e3-bcfd-b76367566d57) |
|
Important Review skippedAuto reviews are limited based on label configuration. 🚫 Excluded labels (none allowed) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
ApprovabilityVerdict: Needs human review Unable to check for correctness in bab8755. This PR adds OpenAPI spec for an existing /enhance endpoint. While purely documentation changes owned by the author, 5 unresolved review comments identify inconsistencies with existing spec conventions (auth patterns, header prefixes, 402 handling) that affect SDK generation - the stated goal of this PR. These design decisions warrant human review. You can customize Macroscope's approvability policy. Learn more. |
PR Summary by QodoDocument POST /v1/enhance in OpenAPI (AI super-resolution, x402)
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
| '402': | ||
| $ref: '#/components/responses/PaymentRequired' |
There was a problem hiding this comment.
🔍 402 handling differs from the other x402-payable endpoints
Other x402-payable operations (/render at openapi.yaml:145-161, /av/remux, /av/demux) define their 402 inline with a WWW-Authenticate challenge header and the Error schema, while /enhance reuses #/components/responses/PaymentRequired, whose documented body is X402PaymentRequired (error as a plain string, normalized error under error_detail) and which advertises the x-payment retry flow rather than WWW-Authenticate. Generated clients will therefore parse enhance 402s differently from render/av 402s; confirm which challenge form the enhance route actually returns.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Verified against wave-gateway source: unauthenticated /v1/enhance requests hit the gateway's paymentChallenge (x402-pay-lane.ts), which returns the X402PaymentRequired JSON envelope with no WWW-Authenticate header, so referencing #/components/responses/PaymentRequired is the accurate form. The inline WWW-Authenticate 402s on /render and /av/* are a pre-existing inconsistency in those entries, out of scope for this PR.
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Code Review by Qodo
1.
|
Qodo FixerNo findings are within the configured fix scope. To change which findings are fixed, adjust the setting on your Qodo configuration page. |
| headers: | ||
| x-enhance-model: | ||
| schema: | ||
| type: string | ||
| description: The model that ran, e.g. `espcn`. | ||
| x-enhance-scale-factor: | ||
| schema: | ||
| type: number | ||
| description: Upscale factor actually applied. | ||
| x-enhance-input-dimensions: | ||
| schema: | ||
| type: string | ||
| description: Input frame dimensions as `WIDTHxHEIGHT`, e.g. `1280x720`. | ||
| x-enhance-output-dimensions: | ||
| schema: | ||
| type: string | ||
| description: Output frame dimensions as `WIDTHxHEIGHT`, e.g. `672x672`. | ||
| x-wave-meter: | ||
| schema: | ||
| type: string | ||
| description: The meter this job billed against — `wave_enhance_minutes`. | ||
| x-wave-usage-minutes: | ||
| schema: | ||
| type: integer | ||
| description: Output-duration minutes billed for this job (rounded up). |
There was a problem hiding this comment.
🔍 Response headers use an x-enhance- prefix instead of the repo's x-wave- convention
Four of the six documented response headers use an x-enhance- prefix (x-enhance-model, x-enhance-scale-factor, x-enhance-input-dimensions, x-enhance-output-dimensions) while the metering headers on the same response use x-wave- (x-wave-meter, x-wave-usage-minutes), and other surfaces in this spec consistently use x-wave-* (e.g. x-wave-sha256 on /render at openapi.yaml:117, x-wave-moq-join at openapi.yaml:92). Worth confirming with the gateway implementation which prefix is actually emitted, since the spec is the SDK source of truth.
Was this helpful? React with 👍 or 👎 to provide feedback.
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
| '401': | ||
| $ref: '#/components/responses/Unauthorized' | ||
| '402': | ||
| $ref: '#/components/responses/PaymentRequired' |
There was a problem hiding this comment.
🔍 Optional-auth pattern differs from other x402 routes in this spec
This operation declares security: [{}, {BearerAuth: []}], whereas the other x402-payable routes (/render at openapi.yaml:118, and the AV routes) use security: [] to disable the global bearer requirement. Both are valid OpenAPI, but the two forms generate different SDK/CLI auth handling (optional-auth vs no-auth). Worth aligning the convention across x402 routes so generated clients behave uniformly.
Was this helpful? React with 👍 or 👎 to provide feedback.
| content: | ||
| video/*: | ||
| schema: | ||
| type: string | ||
| format: binary | ||
| application/octet-stream: | ||
| schema: | ||
| type: string | ||
| format: binary |
There was a problem hiding this comment.
🔍 Wildcard media type video/* in request/response content
The request body and 200 response use the media-type range video/* alongside application/octet-stream. OpenAPI 3.1 permits ranges, but many generators (openapi-generator, oazapfts, some Spectral rulesets) handle wildcard keys poorly or emit awkward method signatures — relevant because the stated motivation of this PR is enabling SDK/CLI generation. Worth verifying the generators used downstream produce a usable binary-body method for this operation.
Was this helpful? React with 👍 or 👎 to provide feedback.
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_1a6e3fe0-9b47-4c10-8219-752aa83502f7) |
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
Summary
Adds the missing OpenAPI entry for
POST /v1/enhance— an AI video super-resolution route thathas been live-routed with no spec entry and no SDK method (closes the contract-drift gap flagged
against wave-gateway#799).
Enhancetag +POST /enhancepath, mirroring the existingRender/MoQ/AV Mux-Demuxpaths' style (x402
PaymentRequiredidiom, binary in/out, per-job receipt headers).espcn(ESPCN super-resolution — a fixed exact 3x factor bakedinto the trained model weights, not a runtime parameter); any other
modelvalue 400s.enhance:writescope. Unauthenticated →402with the same x402challenge shape used elsewhere in this spec (
$ref: '#/components/responses/PaymentRequired').wave_enhance_minutesmeter — the OUTPUT artifact's renderedduration, rounded up to the next whole minute. (I checked the actual spoke source before
writing this: it does not currently apply a resolution-weighting factor to the minute
count — that weighting is an open, undecided pricing question upstream, not shipped code — so
the spec documents plain output-duration minutes rather than inventing a formula.)
?url=fetch, 200 MiB cap), the per-job receiptresponse headers (
x-enhance-model,x-enhance-scale-factor,x-enhance-*-dimensions,x-wave-meter,x-wave-usage-minutes), and the error shapes actually returned by the spoke(
400/401/402/403/413/422/429/501/502/503).Validation
Ran this repo's own CI checks locally (
.github/workflows/foundation-gate.yml):53 warnings is the exact pre-existing baseline this workflow's own comment documents (no new
warnings or errors introduced by this change).
CI on this PR may show as failed/cancelled due to the ongoing GitHub Actions "Service
Unavailable" incident — that is unrelated to this change; see the local runs above for the real
result.
Test plan
npx @redocly/cli lint openapi.yamlpasses with the pre-existing warning count onlyassert-refs.mjsconfirms every$refin the file still resolvesNote
Low Risk
OpenAPI and changelog only; no gateway or spoke behavior changes. Low risk aside from ensuring the documented contract matches the deployed enhance spoke.
Overview
Documents the live
POST /enhanceroute that was routed without an OpenAPI entry, closing contract drift so SDK/CLI clients can be generated.Adds an
Enhancetag andenhanceVideo(POST /enhance): synchronous ESPCN (espcn) super-resolution with optional raw video body or?url=(https, public hosts only, 200 MiB cap). Auth isenhance:writebearer or unauthenticated x402 pay-per-call via the sharedPaymentRequired402 response. Success streams binary video with receipt headers (x-enhance-*,x-wave-meter,x-wave-usage-minutes) and billswave_enhance_minutes(output duration, rounded up).createEnhancementonPOST /studio-ai/enhancementsnow points callers toPOST /enhancefor synchronous ad-hoc bytes vs async library jobs.CHANGELOG.mdrecords the new surface under [Unreleased].Reviewed by Cursor Bugbot for commit 4833622. Configure here.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is enabled.Note
Add
POST /enhanceendpoint for synchronous AI video super-resolution to openapi.yamlPOST /enhancepath to openapi.yaml with operationIdenhanceVideo, supporting theespcnmodel for synchronous video super-resolution.httpsURL via?url=query parameter, with a 200 MiB size limit.x-enhance-model,x-enhance-scale-factor,x-wave-meter,x-wave-usage-minutes, etc.).wave_enhance_minutes.POST /studio-ai/enhancementsdescription to distinguish it from the new synchronous endpoint.Macroscope summarized bab8755.