Hope to send kilo's taskId, conversationId, traceId, project ID, and other data to the AI relay station. #5775
icciccx
started this conversation in
1. Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How can I send taskId, conversationId, traceId, projectId, and other data to an AI intermediary, given that my current API provider is OpenAI Compatible and I am using the gemini-2.5-pro model?
The metadata headers are critical for backend quota tracking, cost attribution, and analytics in multi-tenant/organization scenarios
The OpenAICompatibleHandler base class in the kilocode codebase does not implement customRequestOptions for dynamic per-request headers. Instead, it uses a constructor-level static headers approach. openai-compatible.ts:60-69
The X-KILOCODE-TASKID and other metadata headers are not supported by the base OpenAI compatible handler. This functionality is specific to the KilocodeOpenrouterHandler, which extends OpenRouterHandler and implements a customRequestOptions method for dynamic per-request headers. kilocode-openrouter.ts:58-90
These headers are added dynamically based on the ApiHandlerCreateMessageMetadata passed to each request, enabling conversation tracking, task identification, and organization-level quota management. index.ts:68-99
When the API provider is OpenAI Compatible, only the following headers can currently be obtained
curl 'http://localhost:8090/v1/chat/completions'
-H 'Accept: application/json'
-H 'Accept-Language: *'
-H 'Authorization: ******'
-H 'Content-Type: application/json'
-H 'Http-Referer: https://kilocode.ai'
-H 'Sec-Fetch-Mode: cors'
-H 'User-Agent: Kilo-Code/5.3.0'
-H 'X-Kilocode-Version: 5.3.0'
-H 'X-Stainless-Arch: x64'
-H 'X-Stainless-Lang: js'
-H 'X-Stainless-Os: Windows'
-H 'X-Stainless-Package-Version: 5.12.2'
-H 'X-Stainless-Retry-Count: 0'
-H 'X-Stainless-Runtime: node'
-H 'X-Stainless-Runtime-Version: v22.21.1'
-H 'X-Title: Kilo Code'
-d '{"model":"gemini-2.5-pro","temperature":0,"messages":[xxx],"stream":true,"stream_options":{"include_usage":true}}'
For OpenAI and OpenAI-compatible providers, use the openAiHeaders configuration field, which allows users to specify arbitrary HTTP headers as key-value pairs, However, this approach only supports static headers that don't change per request.
Beta Was this translation helpful? Give feedback.
All reactions