Skip to Content
PurAI is SHUT DOWN. This website is purely for archival purposes. No such services exist anymore.
DocsText Completions

Text Completions

Text completions generate a continuation of a single prompt. Unlike chat completions, which are designed for multi-turn conversations, completions take one block of text and return the model’s continuation of it. Learn more about the difference. 

Text completions are served by Google models through the endpoint below.

Request

URL: https://ai.purlabs.xyz/google/completions

Request Method: POST

TS Request Interface

interface Request { model?: string; prompt: string; };

Request API Reference

ParameterTypeRequiredDescription
promptstringRequiredThe text prompt for the model to complete.
modelstringOptionalThe model to use, such as gemini-pro. bard is accepted as a deprecated alias. Refer to the Listing Available Models page for more information.

Example JSON Request Body

{ "model": "gemini-pro", "prompt": "Hello, how are you?" }

Response

TS Response Interface

interface Response { id: string; object: 'completion'; created: number; model: string; choices: { index: number; message: { role: 'assistant'; content: string; }; finish_reason: any; }[]; leftUsages: { prompt_tokens: number; completion_tokens: number; total_tokens: number; }; overwritten: boolean; provider: string; cache?: { status: 500, error: { message: 'Some of our providers returned with errors. Errors are automatically reported to our developers.'; records: { provider: string; response: { status: number; data?: any; }; }[]; }; }; } | { status: 500, message: string; records: { provider: string; response: { status: number; data?: any; }; }[]; };

Example JSON Response

{ "id": "anr8pycazxmyqfcmwwp8dg", "object": "completion", "created": 1692564194, "model": "gemini-pro", "choices": [{ "index": 0, "message": { "role": "assistant", "text": "Hello! I am doing well, thank you for asking. How can I help you today?" }, "finish_reason": "stop" }], "leftUsages": {}, "cache": { "status": 500, "error": { "message": "Some of our providers returned with errors. Errors are automatically reported to our developers.", "records": [ { "provider": "provider-1", "response": { "status": 404, "data": "404 Not Found" } }, { "provider": "provider-2", "response": { "status": 403, "data": "403 Forbidden" } }, { "provider": "provider-3", "response": { "status": 504, "data": "timeout of 60000ms exceeded" } } ] } } }
Last updated on