Completions
The Completions API exposes the classic OpenAI-compatible text completion workflow for prompt-based generation and legacy integrations.
Native OpenAI Format
Use the completions endpoint for single-prompt generation workloads that do not require a multi-message chat schema.
https://api.dgrid.ai
POST
/v1/completionsRequest Body
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | Yes | - | Target model ID. |
prompt | string or array | Yes | - | Prompt text or prompt array. |
suffix | string | No | - | Optional suffix for insertion use cases. |
max_tokens | integer | No | 16 | Maximum completion length. |
temperature | number | No | 1 | Sampling temperature. |
top_p | number | No | 1 | Nucleus sampling value. |
n | integer | No | 1 | Number of completions to return. |
stream | boolean | No | false | Enable streaming. |
logprobs | integer | No | - | Number of log probability values to return. |
echo | boolean | No | false | Whether to include the prompt in the output. |
stop | string or array | No | - | Stop sequence. |
presence_penalty | number | No | 0 | Presence penalty. |
frequency_penalty | number | No | 0 | Frequency penalty. |
best_of | integer | No | 1 | Server-side reranking count. |
logit_bias | object | No | - | Token bias map. |
user | string | No | - | End-user identifier. |
Response Body
| Field | Type | Description |
|---|---|---|
id | string | Completion identifier. |
object | string | Always text_completion. |
created | integer | Creation timestamp. |
model | string | Model used for generation. |
choices | array | Completion choices. |
choices[].text | string | Generated text. |
choices[].index | integer | Choice index. |
choices[].logprobs | object or null | Log probability output when requested. |
choices[].finish_reason | string | Finish reason. |
usage | object | Token usage metadata. |
