Chat API

Integrate real-time chat capabilities into your applications

Overview

The Chat API enables you to integrate Gconv Prune's chat functionality into your applications. This guide covers authentication, endpoints, and best practices for implementation.

Authentication

Authenticate your requests using an API key:

curl -X POST https://api.gconvprune.fun/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gconvprune-3.5",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'

Endpoints

POST /v1/chat/completions

Create a chat completion:

{
  "model": "gconv-3.5",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"},
    {"role": "assistant", "content": "Hi! How can I help you today?"},
    {"role": "user", "content": "What's the weather like?"}
  ],
  "temperature": 0.7,
  "max_tokens": 150
}

GET /v1/chat/models

List available models:

{
  "data": [
    {
      "id": "gconvprune-3.5",
      "created": 1677649963,
      "object": "model",
      "owned_by": "gconvprune"
    },
    {
      "id": "gconvprune-4",
      "created": 1687649963,
      "object": "model",
      "owned_by": "gconvprune"
    }
  ]
}

Response Format

Example response from the chat completions endpoint:

{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677858242,
  "model": "gconvprune-3.5",
  "usage": {
    "prompt_tokens": 13,
    "completion_tokens": 7,
    "total_tokens": 20
  },
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop",
      "index": 0
    }
  ]
}

Need Help?

For more detailed information about the Chat API, check our API reference or contact our support team.