---
title: "Api Request Logs Create Create"
method: POST
path: "/api/request-logs/create/"
tags: ["logs"]
---

# Api Request Logs Create Create

`POST /api/request-logs/create/`

Centralized respan_params initialization and backward-compat layer.

This mixin is the SINGLE initialization point for ``respan_params``.
It runs ``_initialize_respan_params()`` BEFORE ``super().initial()`` so
that by the time the throttle runs, ``respan_params`` is a fully resolved
dict.  Downstream code (throttle, preprocessing, view handler) only
**enriches** the existing dict — they never need to create it.

Initialization order::

    _initialize_respan_params()   ← legacy rename + header parse + metadata
        ↓
    super().initial()             ← throttle ENRICHES the existing dict
        ↓
    view handler                  ← billing, security strip, etc.

Responsibilities consolidated here (previously scattered across 4 callsites):
1. Legacy header rename  (X-Data-Keywordsai-Params → X-Data-Respan-Params)
2. Parse X-Data-Respan-Params header  (base64 → dict)
3. Legacy body rename  (keywordsai_params → respan_params)
4. Form data handling  (JSON string → dict)
5. Metadata nesting  (passthrough endpoints — Anthropic, Google, etc.)
6. Merge: {**header_params, **body_params}  (body wins on field conflict)
7. Add request_url_path from request.META['PATH_INFO']
8. Guarantee request.data[RESPAN_PARAMS_KEY] is always a dict

Safe for protobuf endpoints: body adaptation is skipped when request.data
is not a dict; header adaptation always runs.

Usage::

    class MyChatView(AdaptRespanParamsMixin, APIView):
        ...

## Headers

- `Authorization` string, required

## Request body

- RequestLogCreateRequest
  - `ip_address` string, nullable
  - `pre_commit_id` string, nullable
  - `custom_identifier` string, nullable
  - `group_identifier` string, nullable
  - `blurred` boolean, nullable
  - `hour_group` string, date-time
  - `minute_group` string, date-time
  - `start_time` string, date-time, nullable
  - `timestamp` string, date-time
  - `load_balance_group_id` string
  - `unique_id` string, nullable
  - `mapped_model_name` string
  - `response_format` union
    - unknown
    - unknown
  - `response_format_choice` string, nullable
  - `parallel_tool_calls` boolean, nullable
  - `prompt_tokens` integer
  - `completion_tokens` integer
  - `prompt_cache_hit_tokens` integer, nullable
  - `prompt_cache_creation_tokens` integer, nullable
  - `total_request_tokens` integer
  - `cost` number, double
  - `input` string
  - `input_array` string[], nullable
  - `encoding_format` string
  - `dimensions` integer, nullable
  - `embedding` number[], nullable
  - `base64_embedding` string, nullable
  - `audio_input_file` string, binary, nullable
  - `transcription` string
  - `audio_response_format` string
  - `audio_output_file` string, binary, nullable
  - `prompt_messages` unknown[]
    - unknown
  - `completion_message` unknown
  - `completion_messages` unknown[], nullable
    - unknown
  - `latency` number, double, nullable
  - `model` string
  - `calling_model` string, nullable
  - `foundation_model` string
  - `provider_id` string
  - `full_model_name` string, nullable
  - `tool_choice` union
    - unknown
    - unknown
  - `tools` union
    - unknown
    - unknown
  - `tool_calls` union
    - unknown
    - unknown
  - `has_tool_calls` boolean
  - `category` string
  - `time_to_first_token` number, double, nullable
  - `routing_time` number, double
  - `keywordsai_params` union
    - unknown
    - unknown
  - `note` string
  - `session_id` string
  - `metadata` unknown
  - `metadata_indexed_string_1` string, nullable
  - `metadata_indexed_string_2` string, nullable
  - `metadata_indexed_numerical_1` number, double, nullable
  - `cached` boolean
  - `cache_bit` integer
  - `cache_miss_bit` integer, nullable
  - `cache_key` string, nullable
  - `positive_feedback` boolean, nullable
  - `tokens_per_second` number, double
  - `full_request` unknown
  - `full_response` unknown
  - `status` union
    - 'success' | 'failed' | 'warning' | 'pending' | 'running' — * `success` - Success * `failed` - Failed * `warning` - Warning * `pending` - Pending * `running` - Running
    - ''
  - `status_code` integer
  - `warnings` string
  - `recommendations` string, nullable
  - `has_warnings` boolean
  - `error_message` string
  - `is_example` boolean
  - `is_malicious` boolean
  - `log_method` 'inference' | 'logging_api' | 'batch' | 'python_tracing' | 'ts_tracing' | 'tracing_integration' — * `inference` - Inference * `logging_api` - Logging Api * `batch` - Batch * `python_tracing` - Python Tracing * `ts_tracing` - Ts Tracing * `tracing_integration` - Tracing Integration
  - `log_type` 'text' | 'chat' | 'completion' | 'response' | 'embedding' | 'transcription' | 'speech' | 'workflow' | 'task' | 'tool' | 'agent' | 'handoff' | 'guardrail' | 'function' | 'custom' | 'generation' | 'unknown' | 'score' | 'batch' | 'span' — * `text` - Text * `chat` - Chat * `completion` - Completion * `response` - Response * `embedding` - Embedding * `transcription` - Transcription * `speech` - Speech * `workflow` - Workflow * `task` - Task * `tool` - Tool * `agent` - Agent * `handoff` - Handoff * `guardrail` - Guardrail * `function` - Function * `custom` - Custom * `generation` - Generation * `unknown` - Unknown * `score` - Score * `batch` - Batch * `span` - Span
  - `failed` boolean
  - `error_bit` integer
  - `is_test` boolean
  - `environment` union
    - 'prod' | 'stage' | 'test' | 'all' — * `prod` - Prod * `stage` - Dev * `test` - Test * `all` - All
    - ''
  - `stream` boolean
  - `stream_options` union
    - unknown
    - unknown
  - `temperature` number, double, nullable
  - `max_tokens` integer, nullable
  - `logit_bias` union
    - unknown
    - unknown
  - `logprobs` boolean, nullable
  - `top_logprobs` integer, nullable
  - `frequency_penalty` number, double, nullable
  - `presence_penalty` number, double, nullable
  - `stop` string, nullable
  - `n` integer, nullable
  - `evaluation_identifier` string, nullable
  - `is_dataset` boolean
  - `based_log_unique_id` string, nullable
  - `customer_identifier` string
  - `customer_email` string, email
  - `customer_name` string
  - `customer_user_unique_id` string, nullable
  - `used_custom_credential` boolean
  - `deployment_name` string
  - `custom_endpoint` string, nullable
  - `custom_region` string, nullable
  - `prompt_name` string, nullable
  - `prompt_id` string
  - `prompt_version_number` integer, nullable
  - `covered_by` 'own_credential' | 'user' | 'credits' | 'credit_and_credential' | 'cache_hit' | 'credit_and_cache' — * `own_credential` - Own Credential * `user` - User * `credits` - Credits * `credit_and_credential` - Credit And Credential * `cache_hit` - Cache Hit * `credit_and_cache` - Credit And Cache
  - `system_text` string, nullable
  - `prompt_text` string, nullable
  - `completion_text` string, nullable
  - `system_text_vector` string, nullable
  - `prompt_text_vector` string, nullable
  - `completion_text_vector` string, nullable
  - `full_text_indexed` boolean
  - `trace_unique_id` string, nullable
  - `span_unique_id` string, nullable
  - `trace_group_identifier` string, nullable
  - `span_name` string, nullable
  - `span_handoffs` string[], nullable
  - `span_tools` string[], nullable
  - `span_parent_id` string, nullable
  - `span_path` string, nullable
  - `span_workflow_name` string, nullable
  - `output` string, nullable
  - `thread_identifier` string
  - `thread_unique_id` string, nullable
  - `storage_object_key` string, nullable
  - `error_message_search` string, nullable
  - `evaluation_cost` number, double
  - `LLM_based_context_precision` number, double, nullable
  - `LLM_based_faithfulness` number, double, nullable
  - `flesch_reading_ease` number, double, nullable
  - `flesch_kincaid_grade_level` number, double, nullable
  - `LLM_based_answer_relevance` number, double, nullable
  - `amount_to_pay` number, double, nullable
  - `full_cost_calculated` boolean, nullable
  - `stripe_usage_report_sent` boolean, nullable
  - `to_update_thread` boolean, nullable
  - `to_update_customer_user` boolean, nullable
  - `organization` integer, nullable
  - `company_organization` integer, nullable
  - `user` integer, nullable
  - `organization_key` string, nullable
  - `customer_user` integer, nullable
  - `prompt_version` integer, nullable
  - `thread` integer, nullable
  - `trace` integer, nullable
  - `span` integer, nullable

## Response `201`

- RequestLogCreate
  - `id` integer, required
  - `ip_address` string, nullable
  - `pre_commit_id` string, nullable
  - `custom_identifier` string, nullable
  - `group_identifier` string, nullable
  - `blurred` boolean, nullable
  - `hour_group` string, date-time
  - `minute_group` string, date-time
  - `start_time` string, date-time, nullable
  - `timestamp` string, date-time
  - `load_balance_group_id` string
  - `unique_id` string, nullable
  - `mapped_model_name` string
  - `response_format` union
    - unknown
    - unknown
  - `response_format_choice` string, nullable
  - `parallel_tool_calls` boolean, nullable
  - `prompt_tokens` integer
  - `completion_tokens` integer
  - `prompt_cache_hit_tokens` integer, nullable
  - `prompt_cache_creation_tokens` integer, nullable
  - `total_request_tokens` integer
  - `cost` number, double
  - `input` string
  - `input_array` string[], nullable
  - `encoding_format` string
  - `dimensions` integer, nullable
  - `embedding` number[], nullable
  - `base64_embedding` string, nullable
  - `audio_input_file` string, uri, nullable
  - `transcription` string
  - `audio_response_format` string
  - `audio_output_file` string, uri, nullable
  - `prompt_messages` unknown[]
    - unknown
  - `completion_message` unknown
  - `completion_messages` unknown[], nullable
    - unknown
  - `latency` number, double, nullable
  - `model` string
  - `calling_model` string, nullable
  - `foundation_model` string
  - `provider_id` string
  - `full_model_name` string, nullable
  - `tool_choice` union
    - unknown
    - unknown
  - `tools` union
    - unknown
    - unknown
  - `tool_calls` union
    - unknown
    - unknown
  - `has_tool_calls` boolean
  - `category` string
  - `time_to_first_token` number, double, nullable
  - `routing_time` number, double
  - `keywordsai_params` union
    - unknown
    - unknown
  - `note` string
  - `session_id` string
  - `metadata` unknown
  - `metadata_indexed_string_1` string, nullable
  - `metadata_indexed_string_2` string, nullable
  - `metadata_indexed_numerical_1` number, double, nullable
  - `cached` boolean
  - `cache_bit` integer
  - `cache_miss_bit` integer, nullable
  - `cache_key` string, nullable
  - `positive_feedback` boolean, nullable
  - `tokens_per_second` number, double
  - `full_request` unknown
  - `full_response` unknown
  - `status` union
    - 'success' | 'failed' | 'warning' | 'pending' | 'running' — * `success` - Success * `failed` - Failed * `warning` - Warning * `pending` - Pending * `running` - Running
    - ''
  - `status_code` integer
  - `warnings` string
  - `recommendations` string, nullable
  - `has_warnings` boolean
  - `error_message` string
  - `is_example` boolean
  - `is_malicious` boolean
  - `log_method` 'inference' | 'logging_api' | 'batch' | 'python_tracing' | 'ts_tracing' | 'tracing_integration' — * `inference` - Inference * `logging_api` - Logging Api * `batch` - Batch * `python_tracing` - Python Tracing * `ts_tracing` - Ts Tracing * `tracing_integration` - Tracing Integration
  - `log_type` 'text' | 'chat' | 'completion' | 'response' | 'embedding' | 'transcription' | 'speech' | 'workflow' | 'task' | 'tool' | 'agent' | 'handoff' | 'guardrail' | 'function' | 'custom' | 'generation' | 'unknown' | 'score' | 'batch' | 'span' — * `text` - Text * `chat` - Chat * `completion` - Completion * `response` - Response * `embedding` - Embedding * `transcription` - Transcription * `speech` - Speech * `workflow` - Workflow * `task` - Task * `tool` - Tool * `agent` - Agent * `handoff` - Handoff * `guardrail` - Guardrail * `function` - Function * `custom` - Custom * `generation` - Generation * `unknown` - Unknown * `score` - Score * `batch` - Batch * `span` - Span
  - `failed` boolean
  - `error_bit` integer
  - `is_test` boolean
  - `environment` union
    - 'prod' | 'stage' | 'test' | 'all' — * `prod` - Prod * `stage` - Dev * `test` - Test * `all` - All
    - ''
  - `stream` boolean
  - `stream_options` union
    - unknown
    - unknown
  - `temperature` number, double, nullable
  - `max_tokens` integer, nullable
  - `logit_bias` union
    - unknown
    - unknown
  - `logprobs` boolean, nullable
  - `top_logprobs` integer, nullable
  - `frequency_penalty` number, double, nullable
  - `presence_penalty` number, double, nullable
  - `stop` string, nullable
  - `n` integer, nullable
  - `evaluation_identifier` string, nullable
  - `is_dataset` boolean
  - `based_log_unique_id` string, nullable
  - `customer_identifier` string
  - `customer_email` string, email
  - `customer_name` string
  - `customer_user_unique_id` string, nullable
  - `used_custom_credential` boolean
  - `deployment_name` string
  - `custom_endpoint` string, nullable
  - `custom_region` string, nullable
  - `prompt_name` string, nullable
  - `prompt_id` string
  - `prompt_version_number` integer, nullable
  - `covered_by` 'own_credential' | 'user' | 'credits' | 'credit_and_credential' | 'cache_hit' | 'credit_and_cache' — * `own_credential` - Own Credential * `user` - User * `credits` - Credits * `credit_and_credential` - Credit And Credential * `cache_hit` - Cache Hit * `credit_and_cache` - Credit And Cache
  - `system_text` string, nullable
  - `prompt_text` string, nullable
  - `completion_text` string, nullable
  - `system_text_vector` string, nullable
  - `prompt_text_vector` string, nullable
  - `completion_text_vector` string, nullable
  - `full_text_indexed` boolean
  - `trace_unique_id` string, nullable
  - `span_unique_id` string, nullable
  - `trace_group_identifier` string, nullable
  - `span_name` string, nullable
  - `span_handoffs` string[], nullable
  - `span_tools` string[], nullable
  - `span_parent_id` string, nullable
  - `span_path` string, nullable
  - `span_workflow_name` string, nullable
  - `output` string, nullable
  - `thread_identifier` string
  - `thread_unique_id` string, nullable
  - `storage_object_key` string, nullable
  - `error_message_search` string, nullable
  - `evaluation_cost` number, double
  - `LLM_based_context_precision` number, double, nullable
  - `LLM_based_faithfulness` number, double, nullable
  - `flesch_reading_ease` number, double, nullable
  - `flesch_kincaid_grade_level` number, double, nullable
  - `LLM_based_answer_relevance` number, double, nullable
  - `amount_to_pay` number, double, nullable
  - `full_cost_calculated` boolean, nullable
  - `stripe_usage_report_sent` boolean, nullable
  - `to_update_thread` boolean, nullable
  - `to_update_customer_user` boolean, nullable
  - `organization` integer, nullable
  - `company_organization` integer, nullable
  - `user` integer, nullable
  - `organization_key` string, nullable
  - `customer_user` integer, nullable
  - `prompt_version` integer, nullable
  - `thread` integer, nullable
  - `trace` integer, nullable
  - `span` integer, nullable

---

[API](https://skmtc.net/keywordsai/apis/api-reference.md) · [All operations](https://skmtc.net/keywordsai/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/keywordsai/api-reference/versions/c26d550029f8/schema)
