> ## Documentation Index
> Fetch the complete documentation index at: https://developers.myhero.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Predict the rest of a sentence

> Predicts how the writer will finish the sentence at the caret — the editor's ghost text. `before` is the document up to the caret; `after`, `documentTitle`, `section` and `terms` are context.

Returns the continuation exactly as it goes after the caret, including any leading space, or an empty string when there is nothing confident to suggest.



## OpenAPI

````yaml post /ai-agent/inline-completion
openapi: 3.1.0
info:
  title: HERO API
  version: current
  description: |-
    The HERO REST API.

    See https://developers.myhero.so for the rendered docs.
servers:
  - url: https://app.myhero.so
security: []
paths:
  /ai-agent/inline-completion:
    post:
      tags:
        - AI
      summary: Predict the rest of a sentence
      description: >-
        Predicts how the writer will finish the sentence at the caret — the
        editor's ghost text. `before` is the document up to the caret; `after`,
        `documentTitle`, `section` and `terms` are context.


        Returns the continuation exactly as it goes after the caret, including
        any leading space, or an empty string when there is nothing confident to
        suggest.
      operationId: aiInlineCompletion
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                before:
                  type: string
                  minLength: 1
                  maxLength: 4000
                after:
                  type: string
                  maxLength: 1000
                documentTitle:
                  type: string
                  maxLength: 300
                section:
                  type: string
                  maxLength: 300
                terms:
                  type: array
                  items:
                    type: string
                    maxLength: 120
                  maxItems: 50
              required:
                - before
      responses:
        '200':
          description: 200 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  text:
                    type: string
                required:
                  - text
        '400':
          description: 400 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: |-
                      Error class name (e.g.

                      ValidationError, NotFound)
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: array
                    items: {}
                required:
                  - error
                  - message
        '401':
          description: 401 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: |-
                      Error class name (e.g.

                      ValidationError, NotFound)
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: array
                    items: {}
                required:
                  - error
                  - message
        '403':
          description: 403 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: |-
                      Error class name (e.g.

                      ValidationError, NotFound)
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: array
                    items: {}
                required:
                  - error
                  - message
        '429':
          description: 429 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: |-
                      Error class name (e.g.

                      ValidationError, NotFound)
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: array
                    items: {}
                required:
                  - error
                  - message
        '502':
          description: 502 response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: |-
                      Error class name (e.g.

                      ValidationError, NotFound)
                  message:
                    type: string
                    description: Human-readable error message
                  details:
                    type: array
                    items: {}
                required:
                  - error
                  - message
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: HERO personal access token

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.