Languages & Environments
Usage Documentation
- Sharing Requests
- Prompt Registry
- Running Requests
- Advanced Logging
- FAQ
Why PromptLayer?
Reference
- REST API Reference
- POSTGet Prompt Template
- POSTPublish Prompt Template
- GETGet Prompt Template Labels
- PATCHMove Prompt Template Labels
- DELDelete a Prompt Template Label
- POSTCreate a Prompt Template Label
- POSTTrack Score
- POSTTrack Prompt
- POSTTrack Group
- POSTTrack Metadata
- GETGet All Prompt Templates
- POSTCreate Dataset from History
- POSTCreate Evaluation Pipeline
- POSTRun Full Evaluation
- GETGet Evaluation
- GETGet Evaluation Score
- DELDelete Reports by Name
- POSTLog Request
- GETGet Agent Version Execution Results
- POSTRun Agent
Reference
Log Request
POST
https://api.promptlayer.com
/
log-request
curl --request POST \
--url https://api.promptlayer.com/log-request \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <x-api-key>' \
--data '{
"provider": "<string>",
"model": "<string>",
"input": {
"content": [
{
"type": "text",
"text": "<string>"
}
],
"input_variables": [],
"template_format": "f-string",
"type": "completion"
},
"output": {
"content": [
{
"type": "text",
"text": "<string>"
}
],
"input_variables": [
"<string>"
],
"template_format": "f-string",
"type": "completion"
},
"request_start_time": "2023-11-07T05:31:56Z",
"request_end_time": "2023-11-07T05:31:56Z",
"parameters": {},
"tags": [],
"metadata": {},
"prompt_name": "<string>",
"prompt_version_number": 1,
"prompt_input_variables": {},
"input_tokens": 0,
"output_tokens": 0,
"price": 0,
"function_name": "",
"score": 0
}'
{
"id": 123,
"prompt_version": {
"prompt_template": {
"content": [
{
"type": "text",
"text": "<string>"
}
],
"input_variables": [],
"template_format": "f-string",
"type": "completion"
},
"commit_message": "<string>",
"metadata": {
"model": {
"provider": "<string>",
"name": "<string>",
"parameters": {}
},
"customField": "<string>"
}
}
}
Log a request to the system. This is useful for logging requests from custom LLM providers.
Headers
API key to authorize the operation.
Body
application/json
Response
201
application/json
Successful Response
The response is of type object
.
Was this page helpful?
curl --request POST \
--url https://api.promptlayer.com/log-request \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <x-api-key>' \
--data '{
"provider": "<string>",
"model": "<string>",
"input": {
"content": [
{
"type": "text",
"text": "<string>"
}
],
"input_variables": [],
"template_format": "f-string",
"type": "completion"
},
"output": {
"content": [
{
"type": "text",
"text": "<string>"
}
],
"input_variables": [
"<string>"
],
"template_format": "f-string",
"type": "completion"
},
"request_start_time": "2023-11-07T05:31:56Z",
"request_end_time": "2023-11-07T05:31:56Z",
"parameters": {},
"tags": [],
"metadata": {},
"prompt_name": "<string>",
"prompt_version_number": 1,
"prompt_input_variables": {},
"input_tokens": 0,
"output_tokens": 0,
"price": 0,
"function_name": "",
"score": 0
}'
{
"id": 123,
"prompt_version": {
"prompt_template": {
"content": [
{
"type": "text",
"text": "<string>"
}
],
"input_variables": [],
"template_format": "f-string",
"type": "completion"
},
"commit_message": "<string>",
"metadata": {
"model": {
"provider": "<string>",
"name": "<string>",
"parameters": {}
},
"customField": "<string>"
}
}
}
Assistant
Responses are generated using AI and may contain mistakes.