Create completion
post/v1/completions
Create a text completion from a given prompt.
Authentication
Send your OLETOKEN API key as a Bearer token. Keys are created on the API Keys page of the console.
Authorization: Bearer $OLETOKEN_API_KEYRequest body
Content-Type:application/json
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | — | |
| prompt | string | string[] | — | |
| max_tokens | integer | — | — |
| temperature | number | — | — |
| top_p | number | — | — |
| n | integer | — | — |
| stream | boolean | — | — |
| stop | string | string[] | — | — |
| suffix | string | — | — |
| echo | boolean | — | — |
Responses
200Response created
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | — | — |
| object | string | — | — |
| created | integer | — | — |
| model | string | — | — |
| choices | object[] | — | — |
| text | string | — | — |
| index | integer | — | — |
| finish_reason | string | — | — |
| usage | Usage | — | — |
| prompt_tokens | integer | — | Number of prompt tokens |
| completion_tokens | integer | — | Number of completion tokens |
| total_tokens | integer | — | Total number of tokens |
| prompt_tokens_details | object | — | — |
| cached_tokens | integer | — | — |
| text_tokens | integer | — | — |
| audio_tokens | integer | — | — |
| image_tokens | integer | — | — |
| completion_tokens_details | object | — | — |
| text_tokens | integer | — | — |
| audio_tokens | integer | — | — |
| reasoning_tokens | integer | — | — |
Example request
curl -X POST 'https://api.oletoken.ai/v1/completions' \
-H "Authorization: Bearer $OLETOKEN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "string",
"prompt": "string"
}'
