Text to Image
Action
GenerateTxt2Img
Introduction
⚠️
This interface is no longer maintained.
This interface is used to generate images using text.
Request
Parameter Name | Type | Description | Required |
---|---|---|---|
Action | String | The corresponding API command name, the current API is GenerateTxt2Img | ✓ |
PublicKey | String | User's public key, which can be obtained from User Center (opens in a new tab) | ✓ |
Signature | String | User signature generated based on public key and API command, see Signature | ✓ |
request_uuid | String | Request UUID, randomly generated using UUID generation method | |
ModelType | String | Model type, reference value: combined_model , custom_model . To use the official model provided by PICPIK, you need to fill in combined_model , and to use a self-trained or uploaded model, you need to fill in custom_model | ✓ |
MainModelId | Int | Main model ID. If ModelType is combined_model , fill in the Id of SystemPreInstallModels ; otherwise, fill in the Id of SelfMainModels | ✓ |
SubModelIds | []int | Submodel list, do not fill in if ModelType is combined_model | |
SubModelParams | []SubModelParam | Submodel parameters. If SubModelIds is used, the weight of the submodel can be controlled through this parameter. | |
BatchSize | Int | Batch image size 1~16 | ✓ |
Steps | Int | Iteration steps 1~150 | ✓ |
CfgScale | Float | Prompt word guidance level 0~30 | ✓ |
Seed | Int | Random number seed | ✓ |
Sampler | String | Sampler ,Reference Support Samplers | ✓ |
Width | Int | Image generation width, max: 1440, min: 16 | ✓ |
Height | Int | Image generation height, max: 1440, min: 16 | ✓ |
ClipSkip | Int | ClipSkip | ✓ |
TranslatePrompt | Bool | Whether to translate the prompt word into English | ✓ |
PositivePrompts | []String | Positive prompts | |
NegativePrompts | []String | Negative prompts | |
EnableControlNet | Bool | Whether to enable controlNet | |
ControlNetParams | []ControlNetParam | ControlNet parameters list (max length:3) | |
UseCustomMainModelVae | Bool | Using main model VAE ,true means use main model VAE,default false |
ControlNetParam
Parameter Name | Type | Description | Required |
---|---|---|---|
ControlNetImg | String | ControlNet image base64 | |
ControlPreSetId | String | ControlNet Default parameter ID, 0: customized, 1: Graffiti and Sketch, 2: Figure's Pose, 3: Anime Line Drawing, 4: Spatial Line Drawing | |
ControlWeight | Float | ControlNet weight 0~2 | |
ModelId | Int | ControlNet model ID | |
PreProcessorId | Int | ControlNet preprocessor ID | |
StartingControlStep | Float | Starting control step of ControlNet | |
EndingControlStep | Float | Ending control step of ControlNet | |
ControlMode | String | Control mode, reference value: Balanced、MyPromptIsMoreImportant、ControlNetIsMoreImportant | |
ResizeMode | String | Resize mode, reference value: JustResize、CropAndResize、ResizeAndFill | |
PreProcessorResolution | Int | PreProcessorResolution | |
Param1Value | Float | Parameter 1 | |
Param2Value | Float | Parameter 2 |
Note: If ControlPreSetId is not 0, you only need to fill in the ControlNetImg and ControlWeight parameter. Otherwise, all parameters need to be filled in. Parameter referenceControlNet Model List
SubModelParam
参数名 | 类型 | 描述信息 | 必填 |
---|---|---|---|
SubModelId | Int | Sub model Id | |
ControlWeight | Float | Sub model control weight(Lora weight) |
Request example
{
"Action": "GenerateTxt2Img",
"PublicKey": "ALLak9M4cNdHXKOJAJJ4k8Hh1hZS2EgJF1D0FlPwfl",
"Signature": "10e99193615e2c363f15f7339b3dac0c91a9272a",
"request_uuid": "fc30beb9-89e3-4f38-9c90-82201fe91d32",
"ModelType": "combined_model",
"MainModelId": 1,
"BatchSize": 1,
"Steps": 20,
"CfgScale": 7.5,
"Seed": -1,
"Sampler": "Euler",
"ClipSkip": 1,
"Width": 512,
"Height": 512,
"PositivePrompts":[
"an apple"
],
"NegativePrompts":[
],
"TranslatePrompt": true
}
Request example with ControlNet
{
"Action":"GenerateTxt2Img",
"PublicKey":"ALLak9M4cNdHXKOJAJJ4k8Hh1hZS2EgJF1D0FlPwfl",
"Signature":"10e99193615e2c363f15f7339b3dac0c91a9272a",
"request_uuid":"fc30beb9-89e3-4f38-9c90-82201fe91d32",
"ModelType":"combined_model",
"MainModelId":1,
"BatchSize":1,
"Steps":20,
"CfgScale":7.5,
"Seed":-1,
"Sampler":"Euler",
"ClipSkip":1,
"Width":512,
"Height":512,
"PositivePrompts":[
"a apple"
],
"NegativePrompts":[
],
"TranslatePrompt":true,
"EnableControlNet":true,
"ControlNetParams":[
{
//ControlNet using preset parameters
"ControlPreSetId":2,
"ControlWeight":1.5,
"ControlNetImg":"data:image/jpeg;base64,xxx"
},
{
//ControlNet using custom parameters, ControlPreSetId need to be set 0
"ControlMode":"Balanced",
"ControlNetImg":"data:image/jpeg;base64,xxx",
"ControlPreSetId":0,
"ControlWeight":1,
"EndingControlStep":1,
"ModelId":4,
"PreProcessorId":5,
"PreProcessorResolution":512,
"ResizeMode":"JustResize",
"StartingControlStep":0,
"Param1Value":10,
"Param2Value":30
}
]
}
Response
Parameter Name | Type | Description | Required |
---|---|---|---|
RetCode | Int | Return status code. If 0, it indicates a successful return; if non-zero, it indicates a failure | ✓ |
Action | String | Operation command name | ✓ |
Message | String | Return error message. When RetCode is non-zero, it provides detailed description information | |
TaskUID | String | Task UID, used to query task details and get results | ✓ |
Response Example
{
"Action":"",
"RetCode":0,
"Message":"",
"TaskUID":"cjr997tleg738lelk3n0"
}
Support Samplers
Sampler Name |
---|
Euler a |
Euler |
LMS |
Heun |
DPM2 |
DPM2 a |
DPM++ 2S a |
DPM++ 2M |
DPM++ SDE |
DPM++ 2M SDE |
DPM fast |
DPM adaptive |
LMS Karras |
DPM2 Karras |
DPM2 a Karras |
DPM++ 2S a Karras |
DPM++ 2M Karras |
DPM++ SDE Karras |
DPM++ 2M SDE Karras |
DDIM |
PLMS |
UniPC |