API Documentation

Your guide to navigating the AI universe.

GET /v1/models

This endpoint allows you to get a list of available models.

Example Output

{
    "object": "list",
    "data": [
        {
            "id": "gpt-3.5-turbo",
            "object": "model",
            "created": 1677610602,
            "owned_by": "openai",
            "description": "The latest GPT-3.5 Turbo model with higher accuracy, improved instruction-following, and format adherence.",
            "context_window": "16385"
        }
    ]
}

POST /v1/chat/completions

This endpoint allows you to interact with the chat models.

Request Body

{
    "model": "string",
    "messages": [ { "role": "string", "content": "string" } ],
    "stream": "boolean (optional, default: false)",
    "stream_options": { "include_usage": "boolean (optional, default: false)" },
    "max_tokens": "integer (optional)",
    "temperature": "float (optional)",
    "top_p": "float (optional)",
    "n": "integer (optional)",
    "stop": "array of strings (optional)",
    "presence_penalty": "float (optional)",
    "frequency_penalty": "float (optional)"
}

Image Input

"messages": [
    {
        "role": "user",
        "content": [
            { "type": "text", "text": "What is in this image?" },
            { "type": "image_url", "image_url": { "url": "..." } }
        ]
    }
]

Responses

{
    "id": "string",
    "object": "string",
    "created": "integer",
    "model": "string",
    "choices": [
        {
            "index": "integer",
            "message": { "role": "string", "content": "string" },
            "finish_reason": "string"
        }
    ],
    "usage": {
        "prompt_tokens": "integer",
        "completion_tokens": "integer",
        "total_tokens": "integer"
    },
    "cost": "float"
}

Code Examples

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