DEV-COMMERCE-02-001 模型网关接口契约
The frontend never stores provider credentials or calls provider endpoints directly. Production integrations sit behind the OceanWay model gateway configured by VITE_API_BASE_URL.
List Models
GET /v1/models?capability={jobType}
The gateway may return any number of models for one tool capability.
{
"models": [
{
"id": "provider-model-id",
"name": "Display name",
"provider": "Provider name",
"capability": "remove-background",
"media": "image",
"status": "available",
"version": "optional-version",
"supportedParameters": ["edge-mode", "edge-refine"]
}
]
}Supported capability values are defined by JOB_TYPES in src/domain/types.ts. The initial visible set is:
remove-backgroundremove-white-backgroundvideo-generatoredit-with-aiproduct-beautifierproduct-stagingai-backgroundshooting-list
Create Job
POST /v1/jobs
{
"type": "remove-background",
"inputAssetId": "asset-id",
"modelId": "provider-model-id",
"prompt": "optional natural language instruction",
"parameters": {
"edge-mode": "fine",
"edge-refine": 72,
"transparent-output": true
}
}The parameters object is intentionally generic. The gateway maps it to provider-specific request fields and rejects unsupported parameters with a normal API error response.
Job Lifecycle
GET /v1/jobs/:idPOST /v1/jobs/:id/cancel
Job responses use queued, running, succeeded, failed, or cancelled. Successful jobs may return outputUrl or multiple outputUrls.
Runtime Modes
VITE_DATA_MODE=mockuses deterministic local jobs and a multi-model mock registry.VITE_DATA_MODE=apiuses the gateway endpoints above.- Access tokens are read from the in-memory
AuthClient; refresh sessions rely on the central HttpOnly cookie.