NinetyFive Docs

POST/completionsRequires X-Api-Key header

Generate Completion

Request a code completion.

Headers

X-Api-KeyRequired
stringNinetyFive API key.
Content-Encoding
stringSet to gzip when the request body is compressed.

Body

user_idRequired
stringIdentifier used for request tracking.
idRequired
stringClient-generated identifier for the completion request.
filepathRequired
stringPath to the file for which the completion is requested.
contentRequired
stringFull contents of the file at the time of the request.
cursorRequired
integerByte offset where the completion should begin.
repo
stringOptional repository name; defaults to an empty string.
context
array<CompletionContext>Optional array of supporting file snippets, each with filepath and content properties.

Request

curl -X POST https://api.ninetyfive.gg/completions \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: nf_123..." \
  -d '{
    "user_id": "123-456-789",
    "id": "req-1",
    "filepath": "src/main.py",
    "content": "def hello():\n    return "hi"",
    "cursor": 32
  }'

SSE Stream

data: {"id": "req-1", "content": "world"}

data: {"id": "req-1", "content": "():", "flush": true}

data: {"id": "req-1", "end": true}
POST/datasetsRequires X-Api-Key header

Submit Dataset

Submit repository data to improve completions generated.

Headers

X-Api-KeyRequired
stringNinetyFive API key.
Content-TypeRequired
stringMust be set to application/json.

Body

blobsRequired
array<BlobData>Blobs to process. Each entry includes object_hash, commit_hash, path, next, and optional diff.
commitsRequired
array<object>Commit metadata referenced by the blobs.
branch_nameRequired
stringBranch that produced the dataset payload.
repo_nameRequired
stringHuman-readable repository identifier.

Request

curl -X POST https://api.ninetyfive.gg/datasets \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: nf_123_..." \
  -d '{
    "blobs": [
      {
        "object_hash": "abc123",
        "commit_hash": "def456",
        "path": "src/index.ts",
        "next": "",
        "diff": null
      }
    ],
    "commits": [
      {
        "hash": "def456",
        "message": "Initial import",
        "timestamp": "2024-05-01T12:00:00Z"
      }
    ],
    "branch_name": "main",
    "repo_name": "my-repo"
  }'

202 Accepted

HTTP/1.1 202 Accepted