API Reference

Documentation

Everything you need to integrate Pawan.Krd into your application.

Response Format

A successful completion returns a JSON object with the model's output and token usage.

📋200 OK
1{ 2 "id": "chatcmpl-abc123", 3 "object": "chat.completion", 4 "created": 1700000000, 5 "model": "pai-001", 6 "choices": [ 7 { 8 "index": 0, 9 "message": { 10 "role": "assistant", 11 "content": "Hello! How can I help you today?" 12 }, 13 "finish_reason": "stop" 14 } 15 ], 16 "usage": { 17 "prompt_tokens": 20, 18 "completion_tokens": 12, 19 "total_tokens": 32 20 } 21}

Response Fields

id

Unique identifier for the completion.

object

Object type - always "chat.completion".

created

Unix timestamp when the completion was created.

model

The model that generated the completion.

choices

Array of completion choices. Each has a message and finish_reason.

usage

Token counts: prompt_tokens, completion_tokens, total_tokens.

Finish Reasons

stop

The model completed its response naturally or hit a stop sequence.

length

The response was cut off due to max_tokens limit.

content_filter

Content was filtered by the safety system.

Streaming

When stream: true is set, the response is sent as Server-Sent Events (SSE). Each chunk contains a delta with the next piece of the response.

📄SSE Stream
1data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1700000000,"model":"pai-001","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]} 2 3data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1700000000,"model":"pai-001","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}]} 4 5data: {"id":"chatcmpl-abc123","object":"chat.completion.chunk","created":1700000000,"model":"pai-001","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]} 6 7data: [DONE]