openapi: 3.2.0 info: title: LiteLLM Prompt Management API description: 'Proxy Server to call 100+ LLMs in the OpenAI format. **Customize Swagger Docs** 👉 ```LiteLLM Admin Panel on /ui```. Create, Edit Keys with SSO. Having issues? Try ```Fallback Login``` 💸 ```LiteLLM Model Cost Map```. 🔎 ```LiteLLM Model Hub```. See available models on the proxy. **Docs**' version: 1.102.1 tags: - name: Prompt Management paths: /prompts/list: get: tags: - Prompt Management summary: List Prompts description: 'List the prompts that are available on the proxy server 👉 Prompt docs Example Request: ```bash curl -X GET "http://localhost:4000/prompts/list" -H "Authorization: Bearer " ``` Example Response: ```json { "prompts": [ { "prompt_id": "my_prompt_id", "litellm_params": { "prompt_id": "my_prompt_id", "prompt_integration": "dotprompt", "prompt_directory": "/path/to/prompts" }, "prompt_info": { "prompt_type": "config" }, "created_at": "2023-11-09T12:34:56.789Z", "updated_at": "2023-11-09T12:34:56.789Z" } ] } ```' operationId: list_prompts_prompts_list_get security: - APIKeyHeader: [] parameters: - name: environment in: query required: false schema: anyOf: - type: string - type: 'null' title: Environment responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ListPromptsResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /prompts/{prompt_id}/versions: get: tags: - Prompt Management summary: Get Prompt Versions description: 'Get all versions of a specific prompt by base prompt ID 👉 Prompt docs Example Request: ```bash curl -X GET "http://localhost:4000/prompts/jack_success/versions" \ -H "Authorization: Bearer " ``` Example Response: ```json { "prompts": [ { "prompt_id": "jack_success.v1", "litellm_params": {...}, "prompt_info": {"prompt_type": "db"}, "created_at": "2023-11-09T12:34:56.789Z", "updated_at": "2023-11-09T12:34:56.789Z" }, { "prompt_id": "jack_success.v2", "litellm_params": {...}, "prompt_info": {"prompt_type": "db"}, "created_at": "2023-11-09T13:45:12.345Z", "updated_at": "2023-11-09T13:45:12.345Z" } ] } ```' operationId: get_prompt_versions_prompts__prompt_id__versions_get security: - APIKeyHeader: [] parameters: - name: prompt_id in: path required: true schema: type: string title: Prompt Id - name: environment in: query required: false schema: anyOf: - type: string - type: 'null' title: Environment responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ListPromptsResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /prompts/{prompt_id}/info: get: tags: - Prompt Management summary: Get Prompt Info description: 'Get detailed information about a specific prompt by ID, including prompt content 👉 Prompt docs Example Request: ```bash curl -X GET "http://localhost:4000/prompts/my_prompt_id/info" \ -H "Authorization: Bearer " ``` Example Response: ```json { "prompt_id": "my_prompt_id", "litellm_params": { "prompt_id": "my_prompt_id", "prompt_integration": "dotprompt", "prompt_directory": "/path/to/prompts" }, "prompt_info": { "prompt_type": "config" }, "created_at": "2023-11-09T12:34:56.789Z", "updated_at": "2023-11-09T12:34:56.789Z", "content": "System: You are a helpful assistant. User: {{user_message}}" } ```' operationId: get_prompt_info_prompts__prompt_id__info_get security: - APIKeyHeader: [] parameters: - name: prompt_id in: path required: true schema: type: string title: Prompt Id - name: environment in: query required: false schema: anyOf: - type: string - type: 'null' title: Environment responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/PromptInfoResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /prompts/{prompt_id}: get: tags: - Prompt Management summary: Get Prompt Info description: 'Get detailed information about a specific prompt by ID, including prompt content 👉 Prompt docs Example Request: ```bash curl -X GET "http://localhost:4000/prompts/my_prompt_id/info" \ -H "Authorization: Bearer " ``` Example Response: ```json { "prompt_id": "my_prompt_id", "litellm_params": { "prompt_id": "my_prompt_id", "prompt_integration": "dotprompt", "prompt_directory": "/path/to/prompts" }, "prompt_info": { "prompt_type": "config" }, "created_at": "2023-11-09T12:34:56.789Z", "updated_at": "2023-11-09T12:34:56.789Z", "content": "System: You are a helpful assistant. User: {{user_message}}" } ```' operationId: get_prompt_info_prompts__prompt_id__get security: - APIKeyHeader: [] parameters: - name: prompt_id in: path required: true schema: type: string title: Prompt Id - name: environment in: query required: false schema: anyOf: - type: string - type: 'null' title: Environment responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/PromptInfoResponse' '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' put: tags: - Prompt Management summary: Update Prompt description: 'Update an existing prompt 👉 Prompt docs Example Request: ```bash curl -X PUT "http://localhost:4000/prompts/my_prompt_id" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d ''{ "prompt_id": "my_prompt", "litellm_params": { "prompt_id": "my_prompt", "prompt_integration": "dotprompt", "prompt_directory": "/path/to/prompts" }, "prompt_info": { "prompt_type": "config" } } }'' ```' operationId: update_prompt_prompts__prompt_id__put security: - APIKeyHeader: [] parameters: - name: prompt_id in: path required: true schema: type: string title: Prompt Id requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/Prompt' responses: '200': description: Successful Response content: application/json: schema: {} '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' delete: tags: - Prompt Management summary: Delete Prompt description: 'Delete a prompt 👉 Prompt docs Example Request: ```bash curl -X DELETE "http://localhost:4000/prompts/my_prompt_id" \ -H "Authorization: Bearer " ``` Example Response: ```json { "message": "Prompt my_prompt_id deleted successfully" } ```' operationId: delete_prompt_prompts__prompt_id__delete security: - APIKeyHeader: [] parameters: - name: prompt_id in: path required: true schema: type: string title: Prompt Id - name: environment in: query required: false schema: anyOf: - type: string - type: 'null' title: Environment responses: '200': description: Successful Response content: application/json: schema: {} '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' patch: tags: - Prompt Management summary: Patch Prompt description: 'Partially update an existing prompt 👉 Prompt docs This endpoint allows updating specific fields of a prompt without sending the entire object. Only the following fields can be updated: - litellm_params: LiteLLM parameters for the prompt - prompt_info: Additional information about the prompt Example Request: ```bash curl -X PATCH "http://localhost:4000/prompts/my_prompt_id" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d ''{ "prompt_info": { "prompt_type": "db" } }'' ```' operationId: patch_prompt_prompts__prompt_id__patch security: - APIKeyHeader: [] parameters: - name: prompt_id in: path required: true schema: type: string title: Prompt Id - name: environment in: query required: false schema: anyOf: - type: string - type: 'null' title: Environment requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchPromptRequest' responses: '200': description: Successful Response content: application/json: schema: {} '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /prompts: post: tags: - Prompt Management summary: Create Prompt description: 'Create a new prompt 👉 Prompt docs Example Request: ```bash curl -X POST "http://localhost:4000/prompts" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d ''{ "prompt_id": "my_prompt", "litellm_params": { "prompt_id": "my_prompt", "prompt_integration": "dotprompt", "prompt_data": {"content": "This is a prompt", "metadata": {"model": "gpt-4"}} }, "prompt_info": { "prompt_type": "config" } }'' ```' operationId: create_prompt_prompts_post requestBody: content: application/json: schema: $ref: '#/components/schemas/Prompt' required: true responses: '200': description: Successful Response content: application/json: schema: {} '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' security: - APIKeyHeader: [] /prompts/test: post: tags: - Prompt Management summary: Test Prompt description: 'Test a prompt by rendering it with variables and executing an LLM call. This endpoint allows testing prompts before saving them to the database. The response is always streamed. 👉 Prompt docs Example Request: ```bash curl -X POST "http://localhost:4000/prompts/test" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d ''{ "dotprompt_content": "---\nmodel: gpt-4o\ntemperature: 0.7\n---\n\nUser: Hello {{name}}", "prompt_variables": { "name": "World" } }'' ```' operationId: test_prompt_prompts_test_post requestBody: content: application/json: schema: $ref: '#/components/schemas/TestPromptRequest' required: true responses: '200': description: Successful Response content: application/json: schema: {} '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' security: - APIKeyHeader: [] components: schemas: TestPromptRequest: properties: dotprompt_content: type: string title: Dotprompt Content prompt_variables: anyOf: - additionalProperties: true type: object - type: 'null' title: Prompt Variables conversation_history: anyOf: - items: additionalProperties: type: string type: object type: array - type: 'null' title: Conversation History type: object required: - dotprompt_content title: TestPromptRequest PatchPromptRequest: properties: litellm_params: anyOf: - $ref: '#/components/schemas/PromptLiteLLMParams' - type: 'null' prompt_info: anyOf: - $ref: '#/components/schemas/PromptInfo' - type: 'null' type: object title: PatchPromptRequest PromptTemplateBase: properties: litellm_prompt_id: type: string title: Litellm Prompt Id content: type: string title: Content metadata: anyOf: - additionalProperties: true type: object - type: 'null' title: Metadata type: object required: - litellm_prompt_id - content title: PromptTemplateBase PromptLiteLLMParams: properties: prompt_id: anyOf: - type: string - type: 'null' title: Prompt Id prompt_integration: type: string title: Prompt Integration api_base: anyOf: - type: string - type: 'null' title: Api Base api_key: anyOf: - type: string - type: 'null' title: Api Key provider_specific_query_params: anyOf: - additionalProperties: true type: object - type: 'null' title: Provider Specific Query Params ignore_prompt_manager_model: anyOf: - type: boolean - type: 'null' title: Ignore Prompt Manager Model default: false ignore_prompt_manager_optional_params: anyOf: - type: boolean - type: 'null' title: Ignore Prompt Manager Optional Params default: false dotprompt_content: anyOf: - type: string - type: 'null' title: Dotprompt Content additionalProperties: true type: object required: - prompt_integration title: PromptLiteLLMParams ListPromptsResponse: properties: prompts: items: $ref: '#/components/schemas/PromptSpec' type: array title: Prompts type: object required: - prompts title: ListPromptsResponse PromptSpec: properties: prompt_id: type: string title: Prompt Id litellm_params: $ref: '#/components/schemas/PromptLiteLLMParams' prompt_info: $ref: '#/components/schemas/PromptInfo' created_at: anyOf: - type: string format: date-time - type: 'null' title: Created At updated_at: anyOf: - type: string format: date-time - type: 'null' title: Updated At version: anyOf: - type: integer - type: 'null' title: Version environment: anyOf: - type: string - type: 'null' title: Environment default: development created_by: anyOf: - type: string - type: 'null' title: Created By type: object required: - prompt_id - litellm_params - prompt_info title: PromptSpec Prompt: properties: prompt_id: type: string title: Prompt Id litellm_params: $ref: '#/components/schemas/PromptLiteLLMParams' prompt_info: anyOf: - $ref: '#/components/schemas/PromptInfo' - type: 'null' type: object required: - prompt_id - litellm_params title: Prompt ValidationError: properties: loc: items: anyOf: - type: string - type: integer type: array title: Location msg: type: string title: Message type: type: string title: Error Type input: title: Input ctx: type: object title: Context type: object required: - loc - msg - type title: ValidationError PromptInfoResponse: properties: prompt_spec: $ref: '#/components/schemas/PromptSpec' raw_prompt_template: anyOf: - $ref: '#/components/schemas/PromptTemplateBase' - type: 'null' environments: anyOf: - items: type: string type: array - type: 'null' title: Environments type: object required: - prompt_spec title: PromptInfoResponse PromptInfo: properties: prompt_type: type: string enum: - config - db title: Prompt Type environment: anyOf: - type: string - type: 'null' title: Environment default: development additionalProperties: true type: object required: - prompt_type title: PromptInfo HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError securitySchemes: APIKeyHeader: type: apiKey description: Bearer token in: header name: x-litellm-api-key