v3
latestOpenAPI 3.1.02026-07-311,4541,5202.3 MBproxy
Api Generate 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):
- Legacy header rename (X-Data-Keywordsai-Params → X-Data-Respan-Params)
- Parse X-Data-Respan-Params header (base64 → dict)
- Legacy body rename (keywordsai_params → respan_params)
- Form data handling (JSON string → dict)
- Metadata nesting (passthrough endpoints — Anthropic, Google, etc.)
- Merge: {**header_params, **body_params} (body wins on field conflict)
- Add request_url_path from request.META['PATH_INFO']
- 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):
...
post/api/generate/
Headers
Authorizationstring required
JWT access token or Respan API key
Response
No response body
ProxyApiGenerateCreateResponse200 required
Empty response body