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

Using Anthropic Chat Completion

Request

URL: https://ai.purlabs.xyz/anthropic/chat/completions

Request Method: POST

TS Interface

interface Request { model: string; messages: { role: 'user' | 'assistant' | 'system' | 'function'; content: string; name?: string; function_call?: object; }[]; max_tokens_to_sample?: number; temperature?: number; top_p?: number; top_k?: number; };

Example JSON Request Body

{ "model": "claude-instant-1", "messages": [ { "role": "user", "content": "Hello, who are you?" }, { "role": "assistant", "content": "I'm Claude, an AI assistant. How can I help you today?" }, { "role": "user", "content": "Can you explain what an API is?" } ] }

Response

TS Response Interface

interface Response { id: string; created: number; model: string; choices: [ { index: number; message: { role: 'assistant', content: string; }; finish_reason: any; } ]; };

Example JSON Response

{ "id": "c20ccfc2db49ca08b17b0b47ddb29ea6bdb750beb7dc146f17fcfb94a9beaf56", "object": "chat.completion", "created": 1690391419, "model": "claude-instant-1.1", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "An API (Application Programming Interface) is a set of rules that lets software applications communicate with each other." }, "finish_reason": "stop_sequence" } ] }
Last updated on