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.
Thread Title (x-thread-title)
Usage: Assigns a custom, human-readable title to a thread.
- This title is displayed in the LangDB UI, making it easier to identify and search for specific conversations.
Public Thread (x-thread-public)
Usage: Makes a thread publicly accessible via a shareable link.
- Set the value to
1ortrueto enable public sharing. - The public URL will be:
https://app.langdb.ai/sharing/threads/{thread_id} - The
x-thread-title, if set, will be displayed on the public thread page.
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