Skip to main content

Test model connection

Test model connection. POST /api/openapi/v1/models/connection-tests, scope admin.v1.models.manage.

  • Scope: admin.v1.models.manage
  • Permission: Manage Models
  • Action: manage
  • Endpoint: POST/api/openapi/v1/models/connection-tests
Use Authorization: Bearer \<API_KEY\>. The application must have subject_scope={"mode":"all"}; restricted scopes return 403. Scopes are independently granted. Do not cache responses. Model configuration covers BYOK custom models and system-model listing. Creation reuses UI test-and-save: probe first, persist nothing on failure, and save without activating on success. models/connection-tests is an independent preflight that persists neither model nor credentials. BYOK feature and management gates, endpoint restrictions and credential handling remain unchanged. Lists remain paginated. Creation requires Idempotency-Key. No update, deletion, activation or credential-rotation operation is added.

Common request headers

Apply the “Authentication and headers” section in “Configure the QwenWork console through APIs”: Authorization is required and X-Request-Id is optional. See this page for the required scope. Whether Idempotency-Key applies and is required is specified in this page’s request parameters; a tracing identifier does not replace an idempotency key.

Request parameters

Request body: required; Content-Type: application/json.
NameLocationTypeRequiredDescriptionExample
api_keybodystring · password | nullNoapi key; format="password", maxLength=8192-
endpoint_urlbodystring · uriYesendpoint url; format="uri", maxLength=2048-
pass_third_party_user_idbodybooleanNopass third party user id-
protocol_profilebodystringYesprotocol profile; enum=["openai_chat_completions_v1"] Values: "openai_chat_completions_v1"-
upstream_modelbodystringYesupstream model; maxLength=255-

Response statuses

HTTP statusTriggerResponse structureClient action
200Request succeededSee “Response” on this pageRead the response.
defaultOther authentication, authorization, validation or dependency errorsSee “General error” in “Configure the QwenWork console through APIs”Handle the status and code; verify the result and idempotency requirements before retrying writes.

Response

Content-Type: application/json
NameTypeRequiredDescriptionExample
codestringYesStable business error code-
resultstringYesresult; enum=["success", "failed"] Values: "failed", "success"-

Errors and retries

Existing UI error codes and validation are preserved. 401/403 indicate authentication or authorization failure; 409 requires rereading before retry; 413 indicates an oversized request; 400/422 indicate invalid input; 503 indicates an unavailable dependency. The response and machine contract are authoritative. Retry idempotent creates with the same Idempotency-Key and payload.