Skip to content

Generate code completions

POST
/api/v4/code_suggestions/completions

Generates code completions. Uses the AI abstraction layer to generate code completions. Requests to this endpoint are proxied to the AI Gateway.

Media type application/json
object
current_file
required

Object that contains information about the current file

object
file_name
required

The name of the current file

string
nullable <= 255 characters
content_above_cursor
required

The content above cursor

string
nullable <= 400000 characters
content_below_cursor

The content below cursor

string
nullable <= 400000 characters
intent

The intent of the completion request, current options are “completion” or “generation”

string
nullable
Allowed values: completion generation
generation_type

The type of generation request

string
nullable
Allowed values: comment empty_function small_file
stream

The option to stream code completion response

boolean
nullable
project_path

The path of the project

string
nullable
Example
namespace/project
user_instruction

Additional instructions provided by a user

string
nullable <= 600000 characters
context

List of related context parts

Array<object>
nullable
object
type
required

The type of a related part of context

string
>= 1 characters
Allowed values: file snippet
name
required

The name of a related part of context

string
nullable <= 255 characters
content
required

The content of a part of context

string
nullable <= 600000 characters

OK

Bad Request