Working with Headers

LangDB API provides robust support for HTTP headers, enabling developers to manage API requests efficiently with enhanced tracing, observability, and organization.

These headers play a crucial role in structuring interactions with multiple LLMs by providing tracing, request tracking, and session continuity, making it easier to monitor, and analyze API usage

Thread ID (x-thread-id)

Usage: Groups multiple related requests under the same conversation

  • Useful for tracking interactions over a single user session.

  • Helps maintain context across multiple messages.

Check Threads for more details.

Run ID (x-run-id)

Usage: Tracks a unique workflow execution in LangDB, such as a model call or tool invocation.

  • Enables precise tracking and debugging.

  • Each Run is independent for better observability.

Check Run for more details.

Label (x-label)

Usage: Adds a custom tag or label to a LLM Model Call for easier categorization.

  • Helps with tracing multiple agents.

Check Label for more details.

Project ID (x-project-id)

Usage: Identifies the project under which the request is being made.

  • Helps in cost tracking, monitoring, and organizing API calls within a specific project.

  • Can be set in headers or directly in the API base URL https://api.us-east-1.langdb.ai/${langdbProjectId}/v1

Last updated

Was this helpful?