Skip to content

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.

POST
https://api.dgrid.ai
POST/v1/completions
Authorization
Authorization: Bearer <DGRID_API_KEY>
Request
application/json
Response
200 · application/json

Request Body

FieldTypeRequiredDefaultDescription
modelstringYes-Target model ID.
promptstring or arrayYes-Prompt text or prompt array.
suffixstringNo-Optional suffix for insertion use cases.
max_tokensintegerNo16Maximum completion length.
temperaturenumberNo1Sampling temperature.
top_pnumberNo1Nucleus sampling value.
nintegerNo1Number of completions to return.
streambooleanNofalseEnable streaming.
logprobsintegerNo-Number of log probability values to return.
echobooleanNofalseWhether to include the prompt in the output.
stopstring or arrayNo-Stop sequence.
presence_penaltynumberNo0Presence penalty.
frequency_penaltynumberNo0Frequency penalty.
best_ofintegerNo1Server-side reranking count.
logit_biasobjectNo-Token bias map.
userstringNo-End-user identifier.

Response Body

FieldTypeDescription
idstringCompletion identifier.
objectstringAlways text_completion.
createdintegerCreation timestamp.
modelstringModel used for generation.
choicesarrayCompletion choices.
choices[].textstringGenerated text.
choices[].indexintegerChoice index.
choices[].logprobsobject or nullLog probability output when requested.
choices[].finish_reasonstringFinish reason.
usageobjectToken usage metadata.