Files
litellm/litellm_server/openapi.json
T
2023-10-25 15:01:29 -07:00

245 lines
6.7 KiB
JSON

{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "LiteLLM API",
"description": "API for LiteLLM"
},
"paths": {
"/chat/completions": {
"post": {
"summary": "Create chat completion for 100+ LLM APIs",
"requestBody": {
"description": "Input parameters for chat completions",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChatCompletionsRequest"
},
"example": {
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "this is a test message from litellm proxy, can you ack"
}
],
"frequency_penalty": 0.0,
"max_tokens": 500,
"n": 1,
"presence_penalty": 0.0,
"stop": "###",
"stream": false,
"temperature": 0.7,
"top_p": 0.8,
"user": "test-litellm"
}
}
}
},
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChatCompletionsResponse"
},
"example": {
"object": "chat.completion",
"id": "chatcmpl-92861fad-b36c-41a1-88db-139344819276",
"choices": [
{
"finish_reason": "stop_sequence",
"index": 0,
"message": {
"content": "I'm a large language model trained by OpenAI, ACK receiving this message",
"role": "assistant"
}
}
],
"created": 1698253693.169062,
"model": "gpt-3.5-turbo",
"usage": {
"prompt_tokens": 14,
"completion_tokens": 102,
"total_tokens": 116
}
}
}
}
},
"500": {
"description": "Server error"
}
}
}
},
"/models": {
"get": {
"summary": "Get models",
"responses": {
"200": {
"description": "Successful operation"
}
}
}
},
"/": {
"get": {
"summary": "Swagger docs",
"responses": {
"200": {
"description": "Successful operation"
}
}
}
}
},
"components": {
"schemas": {
"ChatCompletionsRequest": {
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"role": {
"type": "string"
},
"content": {
"type": "string"
}
},
"required": ["role", "content"]
}
},
"model": {
"type": "string"
},
"frequency_penalty": {
"type": "number"
},
"function_call": {
"type": ["string", "object"]
},
"functions": {
"type": "array"
},
"logit_bias": {
"type": "object"
},
"max_tokens": {
"type": "integer"
},
"n": {
"type": "integer"
},
"presence_penalty": {
"type": "number"
},
"stop": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"stream": {
"type": "boolean"
},
"temperature": {
"type": "number"
},
"top_p": {
"type": "number"
},
"user": {
"type": "string"
},
"caching": {
"type": "boolean"
}
},
"required": ["messages", "model"]
},
"ChatCompletionsResponse": {
"type": "object",
"properties": {
"object": {
"type": "string"
},
"choices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"finish_reason": {
"type": "string"
},
"index": {
"type": "integer"
},
"message": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"role": {
"type": "string"
}
},
"required": ["content", "role"]
},
"usage": {
"type": "object",
"properties": {
"prompt_tokens": {
"type": "integer"
},
"completion_tokens": {
"type": "integer"
},
"total_tokens": {
"type": "integer"
}
},
"required": ["prompt_tokens", "completion_tokens", "total_tokens"]
}
},
"required": ["finish_reason", "index", "message", "usage"]
}
},
"id": {
"type": "string"
},
"created": {
"type": "number"
},
"model": {
"type": "string"
}
},
"required": ["object", "choices", "id", "created", "model"]
}
}
}
}