Skip to content

Standardize request/app metadata across Foundry and Railway deployments #20

@anand-testcompare

Description

@anand-testcompare

Background

We want consistent metadata (app id, app URL/origin, deployment environment, etc.) to be attached to LLM requests regardless of where the API is running (Railway vs Foundry Compute Modules).

Today, OpenRouter/LiteLLM usage logs can show an origin like https://litellm.ai/ and app identifiers that do not reflect our deployment. We already support OpenRouter headers via env vars (e.g. OPENROUTER_HTTP_REFERER, OPENROUTER_APP_TITLE), but the values are not derived/set consistently across runtimes and are easy to forget.

Goals

  • Provide a single, predictable way to configure app identity metadata once and have it applied everywhere.
  • Keep it opt-in/overrideable for local dev.
  • Avoid hardcoding tenant-specific values in the repo.

Proposal

  • Introduce a small metadata layer (e.g. src/common/metadata.py) that resolves:
    • app name/title
    • canonical origin URL / referer
    • optional app/environment identifiers
    • request id propagation
  • Update LM configuration to apply these values to outbound OpenRouter/LiteLLM headers in a consistent way (Foundry + Railway).
  • Document the env vars and recommended defaults in README + Foundry runbook.

Acceptance criteria

  • In Foundry Compute Modules, with minimal config (ideally just APP_URL and APP_TITLE or similar), outbound LLM requests include the correct OpenRouter headers.
  • In Railway, the same config keys work and produce the same headers.
  • Clear logging at startup shows which metadata values were resolved (without leaking secrets).
  • Existing behavior remains unchanged if no new metadata env vars are set.

Notes

This is primarily about observability/attribution and reducing configuration drift across deployment targets.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions