Skip to content

Commit

Permalink
add common identity provider /.well-known/serviceinfo, updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
LostRuins committed Nov 4, 2024
1 parent 847689e commit f153a14
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
37 changes: 35 additions & 2 deletions kcpp_docs.embd
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@
},
"images": {
"description": "KoboldCpp ONLY. If set, takes an array of base64 encoded strings, each one representing an image to be processed.",
"type": "array"
"type": "array",
"items": {
"type": "string"
}
},
"trim_stop": {
"default": false,
Expand Down Expand Up @@ -1168,6 +1171,29 @@
]
}
},
"/.well-known/serviceinfo": {
"get": {
"responses": {
"200": {
"content": {
"application/json": {
"example": {"version":"0.2","software":{"name":"KoboldCpp","version":1.77,"repository":"https://github.com/LostRuins/koboldcpp","homepage":"https://github.com/LostRuins/koboldcpp","logo":"https://raw.githubusercontent.com/LostRuins/koboldcpp/refs/heads/concedo/niko.ico"},"api":{"koboldai":{"name":"KoboldAI API","rel_url":"/api","documentation":"https://lite.koboldai.net/koboldcpp_api","version":1.77},"openai":{"name":"OpenAI API","rel_url ":"/v1","documentation":"https://openai.com/documentation/api","version":1.77}}},
"schema": {
"properties": {},
"type": "object"
}
}
},
"description": "Successful request"
}
},
"description": "Retrieve the common API identity provider",
"summary": "Retrieve the common API identity provider",
"tags": [
"serviceinfo"
]
}
},
"/sdapi/v1/sd-models": {
"get": {
"description": "Gets a list of image generation models. For koboldcpp, only one model will be returned. If no model is loaded, the list is empty.",
Expand Down Expand Up @@ -1364,7 +1390,10 @@
"type": "number"
},
"init_images": {
"type": "array"
"type": "array",
"items": {
"type": "string"
}
},
},
"type": "object"
Expand Down Expand Up @@ -1517,6 +1546,10 @@
"description": "Extended API unique to KoboldCpp",
"name": "api/extra"
},
{
"description": "Common identity API for LLM services",
"name": "serviceinfo"
},
{
"description": "Image Generation API (A1111 compatible)",
"name": "sdapi/v1"
Expand Down
3 changes: 3 additions & 0 deletions koboldcpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -1898,6 +1898,9 @@ def do_GET(self):
elif self.path.endswith(('/api/tags')): #ollama compatible
response_body = (json.dumps({"models":[{"name":"koboldcpp","model":friendlymodelname,"modified_at":"2024-07-19T15:26:55.6122841+08:00","size":394998579,"digest":"b5dc5e784f2a3ee1582373093acf69a2f4e2ac1710b253a001712b86a61f88bb","details":{"parent_model":"","format":"gguf","family":"koboldcpp","families":["koboldcpp"],"parameter_size":"128M","quantization_level":"Q4_0"}}]}).encode())

elif self.path.endswith(('/.well-known/serviceinfo')):
response_body = (json.dumps({"version":"0.2","software":{"name":"KoboldCpp","version":KcppVersion,"repository":"https://github.com/LostRuins/koboldcpp","homepage":"https://github.com/LostRuins/koboldcpp","logo":"https://raw.githubusercontent.com/LostRuins/koboldcpp/refs/heads/concedo/niko.ico"},"api":{"koboldai":{"name":"KoboldAI API","rel_url":"/api","documentation":"https://lite.koboldai.net/koboldcpp_api","version":KcppVersion},"openai":{"name":"OpenAI API","rel_url ":"/v1","documentation":"https://openai.com/documentation/api","version":KcppVersion}}}).encode())

elif self.path=="/api" or self.path=="/docs" or self.path.startswith(('/api/?json=','/api?json=','/docs/?json=','/docs?json=')):
content_type = 'text/html'
if embedded_kcpp_docs is None:
Expand Down

0 comments on commit f153a14

Please sign in to comment.