# 元境API ## 手机注册和登录 手机登录,如果账号不存在先注册后登陆 ### 生成短信验证码 * path /rbac/gen_sms_code.dspy * method 'GET' * parameters cellphone: 手机号 * 返回 ``` { "status": "ok", "data": { "key": # 密钥,需要在登录时带回 } } ``` or ``` { "status": "error", "data": { "message": "key": key # 登陆需带上的key } } ``` ### 登录接口 * path /rbac/phone_login.dspy * method 'POST' * data ``` { "cellphone": "key": # 登陆需带上的key "sms_code": "selected_id": # 只有在手机号对应多账号,用户选择某个账号后需要 # 用户id, 当用户选择了多手机号之一的账户需要, } ``` * 返回 ``` { "status": "ok", "data": { "user": { "id": # 用户id "username": # 用户名 "orgid": # 机构id "nick_name" # 显示名,不存在时显示username ... #其他用户信息 } } } ``` or 当手机号有多个账号 ``` { "status": "choose", # 指示前端多账户,需用户选择 "data": { "key": # 登陆需带上的key "users": recs # 可选账户,现实username,用户选择后将id返回后台 } } ``` ``` { "status": "error", "data": { "message": # 错误信息 } } ``` ## 充值 目前支持支付宝在线充值 ### 发起支付宝充值 * path /unipay/user_recharge.dspy * method "POST" * data ``` { "provider": "alipay", # 充值渠道 "amount": # 充值金额 "currency": "CNY" # 币种 } ``` * 返回 ``` { "status": "ok", "data": { "redirct": url # 充值url } } 重要:由于此URL来自支付宝,需要在新的页签或新window中打开才不会出现跨域错误 ``` or ``` { "status": "error", "data": { "message": 出错信息 } } ``` ## 下游APIkey ### 获得apikey list * path /dapi/downapps.dspy * method GET * return ``` { "status": "ok", "data": { "apikeys": [ { "id": # 应用id "appname": # 应用名 } ] } } or { "status": "error", "data": { "message": # 出错信息 } } ``` ### 申请APIkey * path /dapi/apply_apikey.dspy * method POST * headers ``` { "Content-Type": "application/json" } ``` * data ``` { "appname": # 必须 "description": # 可选 } ``` * return ``` { "status": "ok" } or { "status": "error", "data": { "message": 出错信息 } } ``` ### 查看AKIKEY * path /dapi/get_apikey.dspy * method GET * params ``` { "id": # "获得apikey list" 返回到id } ``` * return ``` { "status": "ok", "data": { "appname": # app名称 "aapikey": # apikey "secretkey": # 加密key } } or { "status": "error", "data": { "message": # 出错信息 } } ``` ## 账户管理 ### 查询账户余额 * path /accounting/mybalance.dspy * method 'GET' * params 无 * 返回 ``` { "status": "ok", "data": [ { "account": # 账号名称 "balance": # 余额 } ] } ``` or ``` { "status": "error", "data": { "message": 错误信息 } } ``` ## 交易管理 ### 查询产品价格 * path /platformbiz/product_query_price.dspy * method "POST" * data ``` { "product_type": "llm" # llm大模型 "product_id": # 大模型id “config_data: # 不同的模型的配置数据不一样 } ``` * 返回 ``` { "status": "ok", "data": { "list_price": # 原价 "price": # 客户价格 "config_data" # 与请求相同 } } ``` ### 查询交易明细 * path /platformbiz/query_orders.dspy * method "GET" * params ``` { "page": # 当前页,缺省第一页 "pagerows": # 每页记录数,缺省80 } ``` * 返回 ``` { "status": "ok", "data": data } data={ "total": # 总记录数 "rows": list of d # 当前页数据数组 } d = { "llmid": # 模型id "name": # 模型名称 "model": # 模型识别名(可能会不同) "use_date": # 使用日期 "use_time: # 使用时间 "usage": # 模型用量 "amount": # 交易金额 "userid", # 用户id "userorgid" # 机构id "status": # 交易状态 "accounting_status": # 记账状态 } ``` ## 文生视频 * path /llmage/vidu_inference.dspy * method "POST" * data ``` { "llmid": # vidu的llmid "prompt": # 提示词 "duration": # 1 - 15 "audio": # 逻辑值, "ratio" # "data":[{"value":"16:9"},{"value":"9:16"},{"value":"4:3"},{"value":"3:4"},{"value":"1:1"}] "resolution": # 分辨率:"data":[{"value":"540p","text":"540p"},{"value":"720p","text":"720p"},{"value":"1080p","text":"1080p"}] } * 返回 流式数据, 每行一个json,json结构: ``` { "status": # FAILED, SUCCEEDED, 其他 # FAILED:失败, error属性中说明失败原因 # SUCCEEDED:成功,video中保存生成视频url “error": # 失败时有效,出错原因 “video”: # 生成的视频,成功时有效 "usage": # 模型计费信息, 成功时有效 “type”: # 类型?看看值是什么 } ``` ## 图生视频 * path /llmage/vidu_inference.dspy * method "POST" * data ``` { "llmid": # vidu的llmid "prompt": # 提示词 "duration": # 1 - 15 "audio": # 逻辑值, "ratio" # "data":[{"value":"16:9"},{"value":"9:16"},{"value":"4:3"},{"value":"3:4"},{"value":"1:1"}] "resolution": # 分辨率:"data":[{"value":"540p","text":"540p"},{"value":"720p","text":"720p"},{"value":"1080p","text":"1080p"}] } ``` * 返回 流式数据, 每行一个json,json结构: ``` { "status": # FAILED, SUCCEEDED, 其他 # FAILED:失败, error属性中说明失败原因 # SUCCEEDED:成功,video中保存生成视频url “error": # 失败时有效,出错原因 “video”: # 生成的视频,成功时有效 "usage": # 模型计费信息, 成功时有效 “type”: # 类型?看看值是什么 } ``` ## 获得同类型所有可用模型 * path /llmage/get_type_llms.dspy * method 'GET' * params ``` { 'type': # 模型类型: 可选 # 文生视频 # 图生视频 # 参考生视频 } ``` * response ``` { 'status': 'ok', 'data': [ # 返回数组 { id: # 模型id name: # 模型名字 model: # 模型识别名 description: # 模型名字 input_fields: # 输入数据描述 } ] } ``` 或 ``` { "status": "error", "data": { "message": # 出错信息 } } ## 获得当天所有任务列表 * path /llmage/get_my_asynctasks.dspy * method 'GET' * params 无 * * return { “status": "ok", "data": [{ "tasks": { "taskid", "ioinfo", # 从这里获得最后一个返回数据,如果成功,有video的url # 如果失败, 有错误信息可以显示 "status": # SUCCEEDED:成功,FAILED:失败, 其他处理中 ... } }] } ## 获得任务状态 * path /llmage/get_asynctask_status.dspy * method 'GET' * params ``` { 'taskid': # 任务id } * return ``` { "status": "ok", "data": { "response": # 后台返回信息,有状态,错误信息或videod url } } ## 测试定价项目 * path /pricing/test_pricing_program.dspy * method POST * params * data ``` { "ppid": #定价项目id "data": # 模型返回的usage的字典数据 } return 计价成功 ``` { "status": "ok", "data": { "ppid": ppid, "data": data, "result": x } } ``` 或 ``` { "status": "error", "data": { "message": # 错误信息 } } ```