Instrumentation Tags

Learn how to integrate Demeterics into your workflows with step-by-step guides and API examples.

Instrumentation Tags

Add metadata to every LLM call using simple inline comments. No SDK required.

How It Works

Add /// KEY value comments at the beginning of your prompts. Demeterics extracts these tags before forwarding to the LLM provider, giving you granular analytics without affecting model behavior.

/// APP customer-support
/// FLOW ticket-response
/// MARKET enterprise
/// VARIANT v3-empathetic

You are a helpful customer support agent.
Respond to the following ticket with empathy...

Key benefits:

  • Tags are stripped before reaching the LLM (zero extra tokens)
  • Works in any tool: n8n, Zapier, Make, REST, SDKs
  • No code changes required—just edit your prompts

Available Tags

Tag Description Example
APP Application or service name /// APP marketing-bot
FLOW Business workflow or process /// FLOW lead-qualification
MARKET Geographic region or segment /// MARKET latam-spanish
VARIANT A/B test variant or experiment /// VARIANT friendly-v2
VERSION Prompt template version /// VERSION 2.3.1
UNIT Team, department, or division /// UNIT sales-team
COMPANY Customer or client identifier /// COMPANY acme-corp
SESSION Conversation or session ID /// SESSION abc123
USER User identifier /// USER user_456
PRODUCT Product line or feature /// PRODUCT premium-tier
PROJECT Project or campaign identifier /// PROJECT q4-campaign
ENVIRONMENT Deployment environment /// ENVIRONMENT production
PRIORITY Request priority level /// PRIORITY high
TAGS Comma-separated flexible labels /// TAGS urgent,vip,escalated

Tag Syntax

Demeterics supports multiple syntax formats for flexibility:

/// APP my-app           # Space-separated (recommended)
/// APP: my-app          # Colon-separated
/// APP = my-app         # Equals-separated
/// APP [my-app]         # Bracket notation
/// APP "my value"       # Quoted values (for spaces)

All formats are equivalent. Use whichever fits your workflow.


Best Practices

1. Be Consistent

Use the same tag values across your organization. /// MARKET us-west and /// MARKET US_West will be tracked as different segments.

2. Start Simple

Begin with 2-3 tags (APP, FLOW, VARIANT) and add more as needed.

3. Use Hierarchical Names

Structure values for easier filtering:

/// APP myproduct-chatbot
/// FLOW myproduct-chatbot-onboarding

4. Version Your Prompts

Track prompt changes over time:

/// APP email-generator
/// VERSION 2.3.1

5. Tag A/B Tests

Compare variants directly in your dashboard:

/// FLOW checkout-upsell
/// VARIANT control        # or "treatment-a", "treatment-b"

Example Use Cases

Multi-Tenant Cost Tracking

Track LLM costs per customer for accurate billing:

/// COMPANY acme-corp
/// UNIT engineering
/// FLOW code-review

A/B Testing Prompts

Compare conversion rates between prompt strategies:

/// FLOW onboarding-welcome
/// VARIANT friendly-casual

Geographic Analysis

Optimize prompts for different markets:

/// MARKET eu-german
/// FLOW product-recommendation

Prompt Version Control

Measure regressions after prompt updates:

/// APP support-agent
/// VERSION 3.1.0

Integration Examples

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    base_url="https://api.demeterics.com/v1",
    default_headers={"X-Demeterics-Key": "YOUR_KEY"}
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{
        "role": "user",
        "content": """/// APP my-app
/// FLOW summarization
/// MARKET enterprise

Summarize the following document..."""
    }]
)

n8n

In your OpenAI node, add tags to the prompt field:

/// APP n8n-workflow
/// FLOW {{ $json.workflow_name }}

{{ $json.user_prompt }}

curl

curl https://api.demeterics.com/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_KEY" \
  -H "X-Demeterics-Key: $DEMETERICS_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [{
      "role": "user",
      "content": "/// APP my-app\n/// FLOW test\n\nHello, world!"
    }]
  }'

Querying Tagged Data

Once tagged, filter your dashboard by any dimension:

  • By App: See all costs for customer-support app
  • By Flow: Compare ticket-response vs refund-request flows
  • By Variant: A/B test results for friendly-casual vs formal
  • By Company: Export monthly spend per customer for invoicing

Use the REST API to query tagged data programmatically.


FAQ

Do tags affect the LLM output?

No. Tags are stripped before the request reaches the LLM provider. The model never sees them.

Do tags add tokens to my bill?

No. Tags are removed before token counting. You only pay for your actual prompt content.

Can I add custom tags?

Use the TAGS field for flexible labeling:

/// TAGS urgent,vip,high-value

What if I forget to add tags?

Requests without tags are still tracked, but grouped under "untagged" in analytics. We recommend always adding at least APP and FLOW.


Next Steps