NinetyFive Docs
POST/completionsRequires X-Api-Key header
Generate Completion
Request a code completion.
Headers
- X-Api-KeyRequired
- string•NinetyFive API key.
- Content-Encoding
- string•Set to gzip when the request body is compressed.
Body
- user_idRequired
- string•Identifier used for request tracking.
- idRequired
- string•Client-generated identifier for the completion request.
- filepathRequired
- string•Path to the file for which the completion is requested.
- contentRequired
- string•Full contents of the file at the time of the request.
- cursorRequired
- integer•Byte offset where the completion should begin.
- repo
- string•Optional 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
- string•NinetyFive API key.
- Content-TypeRequired
- string•Must 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
- string•Branch that produced the dataset payload.
- repo_nameRequired
- string•Human-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