If this project is helpful to you, don’t forget to give me a star or sponsor me a cup of Mixue Ice City~
pip install sparkdesk-api==1.5.0
or
pip install sparkdesk-api==1.5.0 -i https://pypi.org/simple
In Web mode, you need to go to the iFlytek Spark model web side and grab 3 parameters through F12: cookie, fd, GtToken
python sparkdesk_web_cli.py
from sparkdesk_web . core import SparkWeb
sparkWeb = SparkWeb (
cookie = cookie ,
fd = fd ,
GtToken = GtToken
)
# single chat
print ( sparkWeb . chat ( "repeat: hello world" ))
# continue chat
sparkWeb . chat_stream ()
Supports four versions: v3.5, v3.0, v2.0, v1.0 and assistant API. The default interface version is 3.5
Iflytek Spark’s API requires you to go to the official website to apply. You can first create a service, and then go to the "Spark Cognitive Large Model" column on the left side of the service's console page and enter the "Cooperation Consulting" page to apply. Generally, it is faster to apply using the company email.
This mode requires 3 parameters: app_id, api_key, api_secret
from sparkdesk_api . core import SparkAPI
# 默认api接口版本为3.1,配置其他版本需要指定Version参数(2.1或者1.1)
sparkAPI = SparkAPI (
app_id = app_id ,
api_secret = api_secret ,
api_key = api_key ,
# version=2.1,
# assistant_id="xyzspsb4i5s7_v1"
)
sparkAPI . chat_stream ()
The specific calling method and related calling functions are consistent with the Web mode.
If the project is helpful to you, you can sponsor me a cup of Mixue Ice City~
Thanks to the following developers for their contributions to this project: