plaingateway
API reference

Completions

Create a legacy text completion.

POST /completions accepts model as a string, prompt as a string, and max_tokens as an integer.

Request

http
POST https://plaingateway.com/api/v1/completions
Authorization: Bearer sk-pg-v1-...
Content-Type: application/json

{
  "model": "openai/gpt-5.6-luna",
  "prompt": "Say hello in five words.",
  "max_tokens": 32
}

Response

http
HTTP/1.1 200
{
  "id": "gen-SCRUBBED-1",
  "object": "text_completion",
  "created": 1700000000,
  "model": "openai/gpt-5.6-luna",
  "provider": "OpenAI",
  "choices": [
    {
      "index": 0,
      "text": "Hello, it’s nice to meet you!",
      "reasoning": null,
      "logprobs": null,
      "finish_reason": "stop",
      "native_finish_reason": "completed"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 13,
    "total_tokens": 25,
    "cost": 1.8e-05,
    "is_byok": false,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "cache_write_tokens": 0,
      "audio_tokens": 0,
      "video_tokens": 0
    },
    "cost_details": {
      "upstream_inference_cost": 1.8e-05,
      "upstream_inference_prompt_cost": 2.4e-06,
      "upstream_inference_completions_cost": 1.56e-05
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0,
      "image_tokens": 0,
      "audio_tokens": 0
    },
    "service_tier": "default"
  }
}