docs(v2): reconcile batch import design contracts

This commit is contained in:
phamnazage-jpg
2026-05-22 13:38:56 +08:00
parent afce3da3df
commit 485b6e7a6b
5 changed files with 1519 additions and 1326 deletions

View File

@@ -151,19 +151,104 @@ paths:
$ref: '#/components/responses/Unauthorized'
'404':
description: pack not found
/api/batch-import/runs:
post:
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CreateBatchImportRunRequest'
responses:
'200':
description: batch import run created
content:
application/json:
schema:
$ref: '#/components/schemas/BatchImportRunCreateResponse'
'401':
$ref: '#/components/responses/Unauthorized'
get:
security:
- bearerAuth: []
responses:
'200':
description: list batch import runs
content:
application/json:
schema:
$ref: '#/components/schemas/ListBatchImportRunsResponse'
'401':
$ref: '#/components/responses/Unauthorized'
/api/batch-import/runs/{run_id}:
get:
security:
- bearerAuth: []
parameters:
- $ref: '#/components/parameters/RunID'
responses:
'200':
description: batch import run detail
content:
application/json:
schema:
$ref: '#/components/schemas/BatchImportRunDetail'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
description: run not found
/api/batch-import/runs/{run_id}/items:
get:
security:
- bearerAuth: []
parameters:
- $ref: '#/components/parameters/RunID'
responses:
'200':
description: batch import run items
content:
application/json:
schema:
$ref: '#/components/schemas/ListBatchImportRunItemsResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
description: run not found
/api/batch-import/runs/{run_id}/items/{item_id}:
get:
security:
- bearerAuth: []
parameters:
- $ref: '#/components/parameters/RunID'
- $ref: '#/components/parameters/ItemID'
responses:
'200':
description: batch import run item detail
content:
application/json:
schema:
$ref: '#/components/schemas/BatchImportRunItemDetail'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
description: run or item not found
/api/import-batches/{batchID}:
get:
deprecated: true
security:
- bearerAuth: []
parameters:
- $ref: '#/components/parameters/BatchID'
responses:
'200':
description: batch detail
description: v1 legacy batch detail
'401':
$ref: '#/components/responses/Unauthorized'
/api/import-batches/{batchID}/rollback:
post:
deprecated: true
security:
- bearerAuth: []
parameters:
@@ -362,6 +447,18 @@ components:
schema:
type: integer
format: int64
RunID:
name: run_id
in: path
required: true
schema:
type: string
ItemID:
name: item_id
in: path
required: true
schema:
type: string
ProviderID:
name: providerID
in: path
@@ -494,6 +591,274 @@ components:
type: array
items:
$ref: '#/components/schemas/PackProviderInfo'
BatchImportEntry:
type: object
required: [base_url, api_key]
properties:
base_url:
type: string
api_key:
type: string
requested_models:
type: array
items:
type: string
CreateBatchImportRunRequestBase:
type: object
required: [host_id, mode, access_mode, entries]
properties:
host_id:
type: string
mode:
type: string
enum: [strict, partial]
access_mode:
type: string
enum: [subscription, self_service]
confirm_wait_timeout_sec:
type: integer
subscription_users:
type: array
items:
type: string
subscription_days:
type: integer
probe_api_key:
type: string
entries:
type: array
items:
$ref: '#/components/schemas/BatchImportEntry'
CreateBatchImportRunSubscriptionRequest:
allOf:
- $ref: '#/components/schemas/CreateBatchImportRunRequestBase'
- type: object
required: [subscription_users, subscription_days]
properties:
access_mode:
type: string
enum: [subscription]
CreateBatchImportRunSelfServiceRequest:
allOf:
- $ref: '#/components/schemas/CreateBatchImportRunRequestBase'
- type: object
required: [probe_api_key]
properties:
access_mode:
type: string
enum: [self_service]
CreateBatchImportRunRequest:
oneOf:
- $ref: '#/components/schemas/CreateBatchImportRunSubscriptionRequest'
- $ref: '#/components/schemas/CreateBatchImportRunSelfServiceRequest'
BatchImportRunSummary:
type: object
properties:
run_id:
type: string
state:
type: string
enum: [running, completed, completed_with_warnings, failed, cancelled]
mode:
type: string
enum: [strict, partial]
access_mode:
type: string
enum: [subscription, self_service]
total_items:
type: integer
completed_items:
type: integer
active_items:
type: integer
degraded_items:
type: integer
broken_items:
type: integer
warning_items:
type: integer
started_at:
type: string
format: date-time
finished_at:
type: string
format: date-time
nullable: true
BatchImportRunCreateResponse:
type: object
properties:
run_id:
type: string
state:
type: string
result_page:
type: string
total_items:
type: integer
active_items:
type: integer
degraded_items:
type: integer
broken_items:
type: integer
warning_items:
type: integer
ListBatchImportRunsResponse:
type: object
properties:
runs:
type: array
items:
$ref: '#/components/schemas/BatchImportRunSummary'
BatchImportCapabilityTransportProfile:
type: object
properties:
supports_openai_models:
type: boolean
supports_openai_chat_completions:
type: boolean
supports_openai_responses:
type: boolean
supports_anthropic_messages:
type: boolean
auth_style:
type: string
model_id_style:
type: string
known_advisories:
type: array
items:
type: string
BatchImportCapabilityModelProfile:
type: object
properties:
raw_model_id:
type: string
normalized_model_id:
type: string
supports_stream:
type: string
supports_tools:
type: string
supports_reasoning_fields:
type: string
smoke_chat_ok:
type: boolean
BatchImportCapabilityProfile:
type: object
properties:
transport_profile:
$ref: '#/components/schemas/BatchImportCapabilityTransportProfile'
model_profiles:
type: array
items:
$ref: '#/components/schemas/BatchImportCapabilityModelProfile'
BatchImportRunItemSummary:
type: object
properties:
item_id:
type: string
base_url:
type: string
provider_id:
type: string
requested_models:
type: array
items:
type: string
resolved_smoke_model:
type: string
nullable: true
current_stage:
type: string
enum: [probe, provision, confirm, validate, done]
confirmation_status:
type: string
enum: [pending, confirmed, advisory, failed]
access_status:
type: string
enum: [unknown, active, degraded, broken]
retry_count:
type: integer
last_retry_at:
type: string
format: date-time
nullable: true
advisory_messages:
type: array
items:
type: string
last_error_stage:
type: string
nullable: true
last_error:
type: string
nullable: true
BatchImportRunItemEvent:
type: object
properties:
event_id:
type: string
event_type:
type: string
stage:
type: string
attempt:
type: integer
message:
type: string
payload_json:
type: string
created_at:
type: string
format: date-time
BatchImportRunItemDetail:
allOf:
- $ref: '#/components/schemas/BatchImportRunItemSummary'
- type: object
properties:
raw_models:
type: array
items:
type: string
normalized_models:
type: array
items:
type: string
recommended_models:
type: array
items:
type: string
channel_id:
type: integer
format: int64
nullable: true
account_id:
type: integer
format: int64
nullable: true
capability_profile:
$ref: '#/components/schemas/BatchImportCapabilityProfile'
events:
type: array
items:
$ref: '#/components/schemas/BatchImportRunItemEvent'
BatchImportRunDetail:
type: object
properties:
run:
$ref: '#/components/schemas/BatchImportRunSummary'
recent_warnings:
type: array
items:
type: string
ListBatchImportRunItemsResponse:
type: object
properties:
items:
type: array
items:
$ref: '#/components/schemas/BatchImportRunItemSummary'
ImportBatchInfo:
type: object
properties: