Documentation

Quickstart, capability guides and the HTTP reference.
// QUICKSTART

Talk to the assistant from your own code

Everything the editor plugins do is available over a small HTTP interface, so a build script, a bot or an internal tool can ask the same questions your editor asks.

Create a key from the account screen, keep it out of the repository, and send it as a bearer token.

from codepilot import Client

client = Client(api_key=os.environ["CODEPILOT_KEY"])

suggestion = client.complete(
    path="services/recommendations.py",
    prefix=open("services/recommendations.py").read(),
    max_tokens=120,
)

print(suggestion.text, suggestion.confidence)
// API REFERENCE

Six endpoints, no surprises

Every endpoint takes and returns JSON, is versioned in the path, and is rate limited per key.

EndpointWhat it does
POST /v1/completeReturn a ranked completion for a cursor position with the surrounding file as context.
POST /v1/reviewReview a diff and return comments as suggestion blocks.
POST /v1/documentGenerate a doc comment for one symbol in the conventions the file already uses.
POST /v1/refactorRewrite a selection against a named goal and return it as a diff.
GET /v1/index/statusReport how far the workspace index has progressed.
GET /v1/usageReturn this month’s completion count for the calling key.

Written something with the interface? The engineering blog carries the longer walkthroughs.

Read the engineering blog