Skip to content
Home

SDK Operation Manual

  • SDKs are pure-code packages. They do not provide UI, CLI prompts, config-file discovery, or credential storage.
  • Client initialization requires an explicit non-empty API key.
  • timeout can be configured at the client level and overridden per request.
  • getSeaCloudDocs() is offline and requires neither a client nor an API key.
  • Generation calls read model contracts by default to validate params, apply defaults, and plan queue requests. In default auto mode, temporary contract-service failures fall back to raw queue submission.
CapabilityService
LLM chathttps://cloud.vtrix.ai/llm
Queue task lifecyclehttps://cloud.seaart.ai
Model specshttps://cloud-model-spec.vtrix.ai
SkillHubhttps://skill-hub.vtrix.ai/api/v1
flowchart TD
User["Call run / runSync"] --> ValidateInput["Validate modelId and params"]
ValidateInput --> ReadSpec["Read model contract"]
ReadSpec --> PlanRequest["Plan protocol, bodyMode, queue endpoint, and headers"]
PlanRequest --> ValidateParams["Validate params and apply defaults"]
ValidateParams --> DryRun{"dryRun?"}
DryRun -- yes --> Preview["Return request preview"]
DryRun -- no --> Submit["POST queue request"]
Submit --> Task["Return task handle"]
Task --> Sync{"Wait synchronously?"}
Sync -- no --> Manual["Caller polls with tasks.get / getResponse"]
Sync -- yes --> Poll["Poll statusUrl"]
Poll --> Response["GET responseUrl"]
Response --> Result["Return normalized result"]

Use this when the application stores the task ID or delegates polling to a worker.

const task = await client.run("wan25_t2i_preview", params, {
timeout: 60_000,
contract: "auto",
});
console.log(task.id, task.statusUrl, task.responseUrl);

Use this when the caller expects the final result in a single SDK call. On success, output.raw preserves the original response and output.urls recursively collects URL fields. On task failure, the SDK returns status: "failed" with error and does not invent output.

const result = await client.runSync("wan25_t2i_preview", params, {
timeout: 600_000,
});
if (result.status === "failed") {
console.error(result.error?.message);
} else {
console.log(result.output?.urls);
}

dryRun uses the same model-contract planning path and returns endpoint, method, redacted headers, request body, and validation metadata. It does not submit a task, poll status, or read the final response.

const preview = await client.run("wan25_t2i_preview", params, {
dryRun: true,
});
console.log(preview.endpoint);
console.log(preview.request);

tasks.get reads task status. tasks.getResponse reads the final response. Prefer complete statusUrl and responseUrl values returned by the API; use endpoint-based URL construction when those URLs are not available.

const status = await client.tasks.get(task.id, {
statusUrl: task.statusUrl,
endpoint: "wan25_t2i_preview",
});
const finalResult = await client.tasks.getResponse(task.id, {
responseUrl: status.responseUrl ?? task.responseUrl,
endpoint: "wan25_t2i_preview",
});
  • models.list: list available models by page, type, and keywords.
  • models.getSpec and models.get_spec: read model params, protocol, body mode, endpoints, and agent prompt. Generation calls read the same contract automatically by default; call this directly when building forms or explaining params before generation.
  • skills.find: search SkillHub by keyword.
  • skills.list: list SkillHub skills with pagination.

Common SDK errors:

ErrorScenario
AuthErrorMissing, invalid, or unauthorized API key.
BalanceErrorInsufficient balance.
ValidationErrorLocal SDK parameter validation failed.
ModelNotFoundErrorModel is missing or model spec cannot be read.
NetworkErrorHTTP non-2xx or network failure.
TimeoutErrorSingle HTTP request timed out.
TaskTimeoutErrorSynchronous task wait timed out.

TypeScript and Python callers can use isSeaCloudError(error) to detect SDK errors and read stable fields such as type, message, and hint.

TopicTypeScriptPython
Async modelPromise / async iteratorcoroutine / async iterator
NamingcamelCasesnake_case first, with camelCase aliases
Optional paramsoption objectdict or keyword args
Errorsthrows SDK errorsraises SDK errors
dry run resultoverload returns DryRunResultdict with dryRun: True