> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metrixllm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Properties

> Attach arbitrary metadata to your requests for downstream filtering and cost attribution.

Custom properties allow you to tag requests passing through the gateway with arbitrary metadata. This is extremely useful for A/B testing, attributing costs to specific users or customers, and filtering logs.

## Sending custom properties

To attach metadata to a request, add HTTP headers prefixed with `metrix-property-`.

For example, if you want to tag a request with a specific `user_id` and `environment`:

<CodeGroup>
  ```python Python (OpenAI SDK) theme={null}
  response = client.chat.completions.create(
      model="gpt-4o",
      messages=[{"role": "user", "content": "Hello!"}],
      extra_headers={
          "metrix-property-user_id": "usr_12345",
          "metrix-property-env": "production"
      }
  )
  ```

  ```typescript Node.js (OpenAI SDK) theme={null}
  const response = await client.chat.completions.create({
    model: "gpt-4o",
    messages: [{ role: "user", content: "Hello!" }],
  }, {
    headers: {
      "metrix-property-user_id": "usr_12345",
      "metrix-property-env": "production"
    }
  });
  ```

  ```bash cURL theme={null}
  curl https://gateway.metrixllm.com/openai/v1/chat/completions \
    -H "Authorization: Bearer mtx_..." \
    -H "metrix-property-user_id: usr_12345" \
    -H "metrix-property-env: production" \
    -d '{"model": "gpt-4o", "messages": [{"role": "user", "content": "Hello!"}]}'
  ```
</CodeGroup>

<Warning>
  To ensure high performance, the gateway strictly limits custom properties to a maximum of **10 properties per request**. Additional properties are ignored.
</Warning>

## Viewing metadata in the dashboard

All valid properties passed via `metrix-property-*` headers are extracted and saved alongside the request log in a structured JSON format.

In the MetrixLLM dashboard, you can:

* View the properties in the request details panel on the **Request Logs** page.
* Filter the logs table by specific property keys and values.
* Group spend by custom properties in the **Cost Analytics** view (e.g. "Show me the total cost for `user_id = usr_12345`").
