只需一个api就能使用python和php调用阿里云上所有ai大模型
阿里云推出了自家的通义千问和开源的ai大模型调用平台,只要开通apikey就能使用这些模型,包含文生图、ai对话、llama2、sd等几十个ai大模型,后期估计会接入更多,api收费方式也很直接。

我们来一步一步开通调用吧。
1、开通DashScope灵积模型服务:https://dashscope.console.aliyun.com/overview

2、创建apikey :https://dashscope.console.aliyun.com/apiKey

3、查看计费方式

4、直接调用吧
我们以php为例
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$body = [
'model' => 'qwen-turbo',
// 'model' => 'qwen-plus-v1',
'input' => ['prompt' => '你是谁?'],
];
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($body, JSON_UNESCAPED_UNICODE));
curl_setopt($ch, CURLOPT_POST, 1);
/...点击查看剩余70%
网友评论0