Skip to main content

POST /api/suggest

Generate intelligent inline suggestions based on the current context. This endpoint integrates with the user’s memory system to provide personalized, context-aware completions.

Request Body

string
required
The current text context where the suggestion will be inserted. This can be selected text or the text around the cursor.
string
required
Unique identifier for the user. Used to retrieve personalized memories.
string
Optional instruction to guide the suggestion. For example: “complete this sentence” or “suggest next steps”.
string
default:"gpt-4o-mini"
The AI model to use for generation. Supported models include:
  • gpt-4o-mini (default)
  • gpt-4o
  • claude-3-5-sonnet-20241022
  • groq/llama-3.3-70b-versatile
  • cerebras/llama-3.3-70b

Response

The endpoint returns a streaming text response with the AI-generated suggestion.
string (streaming)
The generated text suggestion, streamed token-by-token for real-time display.

Memory Integration

The suggest endpoint uses three memory tools to provide personalized suggestions:
  1. searchMemory - Searches relevant memories based on the context
  2. addMemory - Stores new facts learned during the interaction
  3. getAllMemories - Retrieves all user memories for comprehensive context
The system automatically:
  • Searches for relevant personal preferences and past context
  • Incorporates your coding style, preferences, and recent work
  • Stores new insights for future suggestions

Example Request

Example Response (Streaming)

Use Cases

Code Completion

Intelligent code completions that match your style and patterns

Writing Assistance

Context-aware text completions for emails and documents

Next-Step Suggestions

Suggest logical next steps based on current context

Personalized Help

Suggestions that incorporate your preferences and history

Keyboard Shortcut

Trigger inline suggestions with Ctrl+Space in the Tabby desktop app. Source: nextjs-backend/src/app/api/suggest/route.ts
  • Completion - General text transformations and completions
  • Chat - Full conversational AI with memory
  • Search Memory - Directly query the memory system