Skip to main content
POST
/
api
/
v1
/
completions
Get completions
curl --request POST \
  --url https://api.webless.ai/api/v1/completions \
  --header 'Content-Type: application/json' \
  --data '
{
  "prefix": "How is",
  "sessionId": "a1c2d3e4-1111-2222-3333-444455556666"
}
'
{
  "prefix": "How is",
  "completions": [
    {
      "text": "How is pricing structured?",
      "suffix": " pricing structured?",
      "score": 0.91
    }
  ],
  "best": {
    "text": "How is pricing structured?",
    "suffix": " pricing structured?",
    "score": 0.91
  }
}
Use this endpoint for inline query autocomplete while a user is typing. It is separate from suggestions, which returns follow-up prompts after a query is submitted.
Call the endpoint after a short delay when the user stops typing, using the current prefix. Abort in-flight requests when the prefix changes. Use the returned suffix to render ghost text after the user’s typed text. Pass previous_completions when you want to avoid repeating completions already shown to the user. When is_private_session is true, the API returns an empty completion set.

Body

application/json
prefix
string
required

User-typed prefix. Internal whitespace runs are normalized server-side.

Example:

"How is"

sessionId
string
required
Example:

"a1c2d3e4-1111-2222-3333-444455556666"

company
string
default:sigma
Example:

"YOUR_COMPANY"

version
enum<string>
default:published

Runtime package pointer. Omit this field or use published for production traffic. Use unpublished only when testing an unpublished runtime package.

Available options:
published,
unpublished
n
integer
default:5

Maximum number of completions to return. Capped at 10.

Required range: 0 <= x <= 10
Example:

5

previous_completions
string[] | null

Exact completions to exclude from results.

Example:
["How is pricing structured?"]
requestId
string
Example:

"1f7c5f74-7b9e-4a0a-9b7d-4e3e2a5e3b60"

is_private_session
boolean
default:false

When true, returns an empty completion set.

Response

Inline autocomplete completions for the supplied prefix

prefix
string
required

Normalized prefix echoed from the request.

completions
object[]
required

Ranked completion candidates. Empty when no matches are available.

best
object
required

Top-ranked completion, if any.