POST /v1/completions accepts a text prompt, not a messages conversation. Confirm endpoint support with the deployment operator; new applications generally start with Chat or Responses. An SDK method does not prove a chat model supports this endpoint.
This example requests one text completion and reads choices[0].text, requiring finish_reason=stop. Streaming increments also use text, not Chat’s delta.content. Length limits, filtering, truncated streams, and empty text fail validation. Output is buffered until completion. The SDK parses SSE; the example validates completion fields and provides no stream resumption.
Install dependencies and set API_BASE_URL (including /v1), API_KEY, and API_MODEL as in Python SDK.
suffix, echo, logprobs, or best_of depends on the converter. Protocol reference: OpenAI Completions; gateway behavior follows this project’s implementation.