An OpenAI style API for OpenSPG Solver.
- Python 3.10+
- KAG 0.8+
- Clone the repository
git clone https://github.com/thundax-lyp/openspg-solver-api.git
cd openspg-solver-api- Create Conda Environment
create conda -n openspg-solver-api python=3.10
conda activate openspg-solver-api- Install requirements
pip install -r requirements.txt-
Copy
kag_config.yamlfiles into./configfolder -
Run API Server
python api.py --host=0.0.0.0 --port=8888 --openspg-service=http://127.0.0.1:8887http://127.0.0.1:8888/See kag_additions
Request
curl -X 'GET' \
'http://127.0.0.1:8888/api/openspg/v1/models' \
-H 'accept: application/json'Response
{
"object": "list",
"data": [
{
"id": "openspg/TwoWiki",
"object": "model",
"created": 1742525286,
"owned_by": "owner"
},
{
"id": "openspg/BaiKe",
"object": "model",
"created": 1742525286,
"owned_by": "owner"
}
]
}Request
curl -X 'POST' \
'http://127.0.0.1:8888/api/openspg/v1/chat/completions' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer none' \
-d '{
"model": "openspg/BaiKe",
"messages": [
{
"role": "user",
"content": "周杰伦曾经为哪些自己出演的电影创作主题曲?"
}
]
}'