Session management for image generation

更新时间:
复制 MD 格式

Integration guide

Scenarios

You can integrate Automatic1111-WebUI, ComfyUI, or other tool interfaces directly into your business scenarios without developing a separate frontend interface.

Complete the following steps:

  • Create an application to obtain an AccessKey pair (AK/SK): Create an application

  • Integrate the software development kit (SDK): Legacy SDK Reference

  • Integrate the Token and Session APIs to manage account binding and the end-user service lifecycle. In most scenarios, you only need to integrate the following two APIs. For more information about tokens and sessions, see the next section.

    • Allocate a token to bind an end-user account. Bind one token to one account.

    • Create or refresh a session to manage the service lifecycle for a specific token. This ensures that users can access the image generation features or other services of AI Creation Workshop within a specific time frame.

  • Custom domain name: If you want to use your own domain name for end users, set a custom domain name in the application configuration (WebUI domain name). You can skip this step if you use the page URL that we provide.

Core concepts

Token

A token is a digital credential for identity authentication and end-user management. In the UI services of AI Creation Workshop, such as WebUI, ComfyUI, and other tool UIs, a token is used to bind your end users. This lets you identify users and track their behavior when they access the UI services.

Call the token generation API to create a token. After a token is created, bind it to a user account. Each token stores personalized information and image generation history. Note: Do not bind a single token to multiple users. Doing so can lead to a disorganized interface, conflicts in model collection data, and data breaches of image generation history.

Session

A session is a temporary interactive instance that manages a user's access state. In the UI services of AI Creation Workshop, you can create or refresh a session with a specific token to provide a controlled access environment for the end user.

When you create a session for a specific token, the system returns a UI environment URL. This URL ensures that the user can access the image generation features or other services of AI Creation Workshop only within a specific time frame.

Sessions are time-limited. When you create or refresh a session, you can set an access duration. This helps prevent potential data breaches or security risks that could arise from a URL that remains valid for a long time.

Interaction flow

image

API checklist

Token management

Session management