Files
letta-code/src/agent/http-headers.ts
2026-01-27 15:02:01 -08:00

25 lines
711 B
TypeScript

import packageJson from "../../package.json";
/**
* Get standard headers for manual HTTP calls to Letta API.
* Use this for any direct fetch() calls (not SDK calls).
*/
export function getLettaCodeHeaders(apiKey?: string): Record<string, string> {
return {
"Content-Type": "application/json",
"User-Agent": `letta-code/${packageJson.version}`,
"X-Letta-Source": "letta-code",
...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}),
};
}
/**
* Get headers for MCP OAuth connections (includes Accept header for SSE).
*/
export function getMcpOAuthHeaders(apiKey: string): Record<string, string> {
return {
...getLettaCodeHeaders(apiKey),
Accept: "text/event-stream",
};
}