insert_log
Insert log records for requests that bypassed the gateway. Writes request, response, and trace metadata into Portkey; the request provider must match a configured integration.
Instructions
Insert log records for requests that bypassed the gateway. This writes request, response, and trace metadata into Portkey immediately, and the call will fail if request_provider does not match a configured integration. Use the span fields to stitch trace hierarchies together.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| request_url | No | The endpoint URL being called | |
| request_body | No | Request payload/body | |
| metadata_user | No | User identifier for the log | |
| response_body | No | Response payload/body | |
| response_time | No | Response latency in milliseconds | |
| request_method | No | HTTP method used (defaults to 'post') | post |
| streaming_mode | No | Whether the response was streamed | |
| metadata_custom | No | Additional custom metadata key-value pairs | |
| request_headers | No | Request headers as key-value pairs | |
| response_status | No | HTTP response status code (defaults to 200) | |
| metadata_span_id | No | Span ID for tracing | |
| request_provider | No | AI provider name (e.g., 'openai', 'anthropic') | |
| response_headers | No | Response headers as key-value pairs | |
| metadata_trace_id | No | Trace ID for distributed tracing | |
| metadata_span_name | No | Span name for tracing | |
| metadata_organization | No | Organization identifier for the log | |
| metadata_parent_span_id | No | Parent span ID for tracing |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the tool call succeeded and returned structured data | |
| data | No | Structured success payload when ok is true | |
| error | No | Structured error payload when ok is false |