Chat Completion

triangle-exclamation

Introduction

This API provides an AI-powered chat completion endpoint. It takes user messages and generates responses using a lightweight AI model. The API does not store user messages—all responses are generated in real-time and discarded after processing. To be frank, I'm too broke to pay for D1 storage for your messages.


Endpoint

POST  https://api.elliott.diy/v1/ai/chat/completions

Request Parameters

Parameter
Type
Required
Description

messages

Array

✅ Yes

A list of chat messages, where the last message is used for AI generation.

Example Request

curl -X POST  https://api.elliott.diy/v1/ai/chat/completions/ \
     -H "Content-Type: application/json" \
     -d '{
       "messages": [
         { "role": "user", "content": "Hello, how are you?" }
       ]
     }'

Response Format

  • Content-Type: application/json

  • Status Codes:

    • 200 OK – Successful response

    • 400 Bad Request – Invalid JSON or missing messages

    • 500 Internal Server Error – AI service is unavailable

Example Response


Response Fields

Field
Type
Description

id

String

Unique identifier for the response.

object

String

Always "chat.completion".

created

Integer

UNIX timestamp of when the response was generated.

model

String

Always "elliott-1".

choices

Array

Contains AI-generated message(s).

message.role

String

Always "assistant".

message.content

String

The AI-generated response.

finish_reason

String

Indicates why the response stopped (e.g., "stop").


Model Information

  • Base Model Used: @hf/google/gemma-7b-it

  • Custom Model Name: "elliott-1" (I'm so creative)

  • The model generates responses based on the last user message in the request.

Last updated