Create a text completion

Send a single prompt string and receive a plain text completion, without the chat message structure.

POST/completions

Send a single prompt string and receive a plain text completion, without the chat message structure.

This is OpenAI's older completions contract, kept so that existing code written against it keeps working. The completion object has no reasoning_content field. Olive still reasons internally, but only /chat/completions returns that reasoning as a separate field. For anything new, prefer /chat/completions.

Authorization

BearerAuth
AuthorizationBearer <token>

Your Avey API key, sent as Authorization: Bearer <key>. This is the header the OpenAI SDKs already send, so pass the key as the client's ordinary api_key and no further configuration is needed.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

The body of a text completion request.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl https://api.avey.ai/llm/completions \  -H "Authorization: Bearer $AVEY_API_KEY" \  -H "Content-Type: application/json" \  -d '{    "model": "olive",    "prompt": "Summarize this discharge note in plain language:",    "max_tokens": 512  }'
{  "id": "cmpl-3b8d5c1a7e2f4d6b9c0a1e3f5d7b2a48",  "object": "text_completion",  "model": "olive",  "choices": [    {      "index": 0,      "text": "You were treated for a chest infection and are going home on a five-day course of antibiotics.",      "finish_reason": "stop"    }  ],  "usage": {    "prompt_tokens": 38,    "completion_tokens": 274,    "total_tokens": 312  }}