Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jiannei/spark-ai
讯飞星火大模型非官方 SDK
https://github.com/jiannei/spark-ai
ai spark-ai
Last synced: 5 days ago
JSON representation
讯飞星火大模型非官方 SDK
- Host: GitHub
- URL: https://github.com/jiannei/spark-ai
- Owner: jiannei
- Created: 2023-11-25T07:15:46.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-04-12T02:39:04.000Z (7 months ago)
- Last Synced: 2024-10-13T15:28:00.177Z (about 1 month ago)
- Topics: ai, spark-ai
- Language: PHP
- Homepage: https://sinan.fun
- Size: 18.6 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
spark-ai
> 讯飞星火大模型非官方 SDK.
[![StyleCI](https://github.styleci.io/repos/723286499/shield?branch=main&style=flat)](https://github.styleci.io/repos/723286499?branch=main&style=flat)
[![Latest Stable Version](http://poser.pugx.org/jiannei/spark-ai/v)](https://packagist.org/packages/jiannei/spark-ai)
[![Total Downloads](http://poser.pugx.org/jiannei/spark-ai/downloads)](https://packagist.org/packages/jiannei/spark-ai)
[![Latest Unstable Version](http://poser.pugx.org/jiannei/spark-ai/v/unstable)](https://packagist.org/packages/jiannei/spark-ai)
[![License](http://poser.pugx.org/jiannei/spark-ai/license)](https://packagist.org/packages/jiannei/spark-ai)## 介绍
- [星火大模型 API 免费套餐](https://xinghuo.xfyun.cn/sparkapi?scr=price)
- [官方文档](https://www.xfyun.cn/doc/spark/Web.html)## 安装
```shell
$ composer require jiannei/spark-ai -vvv
```## 使用
- 在[控制台](https://console.xfyun.cn/services/bm3)获取服务接口认证信息:APPID、APISecret、APIKey
- 流式输出
```php
use Jiannei\SparkAi\SparkAi;$answer = SparkAi::getInstance()->withConfig([
'url' => 'wss://spark-api.xf-yun.com/v3.1/chat',
'app_id' => '',// 填入控制台中获取的 APPID
'api_key' => '',// 填入控制台中获取的 APISecret
'api_secret' => '',// 填入控制台中获取的 APIKey
])->chat()->create('你是谁?');foreach ($answer as $item) {
print_r($item);
}
```![answer](https://raw.githubusercontent.com/jiannei/snc-pro/master/images/202401101917408.gif)
- 完整输出
```php
use Jiannei\SparkAi\SparkAi;$answer = SparkAi::getInstance()->withConfig([
'url' => 'wss://spark-api.xf-yun.com/v3.1/chat',
'app_id' => '',// 填入控制台中获取的 APPID
'api_key' => '',// 填入控制台中获取的 APISecret
'api_secret' => '',// 填入控制台中获取的 APIKey
])->chat()->answer('你是谁?');print_r($answer);
```## License
MIT