Endpoint
Request parameters
Array of message objects representing the conversation history. Each message should contain:
role(string): Either “user” or “assistant”content(string): The message content
The AI model to use for generating responses. Supported values:
gpt-4.1-mini(default) - OpenAI GPT-4.1 Minigemini-2.5-flash- Google Gemini 2.5 Flash
gpt-4.1-mini.Response
Returns a streaming response with AI-generated content. The maximum streaming duration is 30 seconds. The response uses the AI SDK’s data stream format, which includes:- Text content chunks
- Tool calls (for the
editFiletool) - Tool results
System behavior
The AI assistant operates with a specialized system prompt that defines its role as an expert LaTeX developer. Key behaviors include:- Iterative editing: Works back and forth with users on LaTeX documents
- File editing: Uses the
editFiletool to modify LaTeX files - User-focused: Prioritizes immediate questions and needs
- Mathematical expressions: Supports GitHub Flavored Markdown with LaTeX math syntax
- Language adaptation: Responds in the same language as the user’s message
docs/system-prompt.md at runtime.
Available tools
The assistant has access to the following tool:editFile
Edits the current LaTeX file with new content. Parameters:newFile(string, required): The complete new file content that will replace the current file
Example request
Error handling
The endpoint returns standard HTTP error codes:400- Bad request (invalid JSON or missing required fields)500- Internal server error (model unavailable, system prompt not found)