import{_ as i,c as a,ae as n,o as t}from"./chunks/framework.BzDBnRMZ.js";const d=JSON.parse('{"title":"util_hunyuan","description":"","frontmatter":{"title":"util_hunyuan","order":100},"headers":[],"relativePath":"en/dev/api/util_hunyuan.md","filePath":"en/dev/api/util_hunyuan.md","lastUpdated":1734175019000}'),e={name:"en/dev/api/util_hunyuan.md"};function h(l,s,p,k,r,E){return t(),a("div",null,s[0]||(s[0]=[n(`
nonebot_plugin_marshoai.util_hunyuan
generate_image(prompt: str)
def generate_image(prompt: str):
cred = credential.Credential(config.marshoai_tencent_secretid, config.marshoai_tencent_secretkey)
httpProfile = HttpProfile()
httpProfile.endpoint = 'hunyuan.tencentcloudapi.com'
clientProfile = ClientProfile()
clientProfile.httpProfile = httpProfile
client = hunyuan_client.HunyuanClient(cred, 'ap-guangzhou', clientProfile)
req = models.TextToImageLiteRequest()
params = {'Prompt': prompt, 'RspImgType': 'url', 'Resolution': '1080:1920'}
req.from_json_string(json.dumps(params))
resp = client.TextToImageLite(req)
return resp.to_json_string()