openapi: 3.0.3 info: title: Letta Agent Templates Chat Completions API description: The Letta API creates and operates stateful AI agents whose memory - core context blocks and archival vector memory - persists across sessions. It configures the tools, data sources, identities, and multi-agent groups an agent uses, sends and streams messages to agents, and inspects the runs, jobs, and steps behind every agent response. The same OpenAPI-documented interface is served by the managed Letta Cloud API and by the open-source, self-hostable Letta server. All requests require a Bearer API key. version: 1.0.0 contact: name: Letta url: https://www.letta.com license: name: Apache-2.0 url: https://github.com/letta-ai/letta/blob/main/LICENSE servers: - url: https://api.letta.com/v1 description: Letta Cloud - url: http://localhost:8283/v1 description: Self-hosted (default local port) security: - bearerAuth: [] tags: - name: Chat Completions description: OpenAI-compatible chat completions backed by a Letta agent. paths: /v1/chat/completions: post: tags: - Chat Completions summary: Create Chat Completion description: Create a chat completion using a Letta agent (OpenAI-compatible). requestBody: required: true content: application/json: schema: type: object additionalProperties: true responses: '200': description: Successful response content: application/json: schema: type: object additionalProperties: true text/event-stream: description: Server-Sent Events stream '401': $ref: '#/components/responses/Unauthorized' '422': $ref: '#/components/responses/ValidationError' components: responses: ValidationError: description: The request payload failed validation. content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' Unauthorized: description: Missing or invalid Bearer API key. content: application/json: schema: $ref: '#/components/schemas/Error' schemas: Error: type: object properties: error: type: object properties: message: type: string code: type: string HTTPValidationError: type: object properties: detail: type: array items: type: object properties: loc: type: array items: type: string msg: type: string type: type: string securitySchemes: bearerAuth: type: http scheme: bearer description: 'API key created at https://app.letta.com/api-keys, passed as `Authorization: Bearer YOUR_API_KEY`.'