POST
/
completions
curl https://api.portkey.ai/v1/completions \
  -H "Content-Type: application/json" \
  -H "x-portkey-api-key: $PORTKEY_API_KEY" \
  -H "x-portkey-virtual-key: $PORTKEY_PROVIDER_VIRTUAL_KEY" \
  -d '{
    "model": "gpt-3.5-turbo-instruct",
    "prompt": "Say this is a test",
    "max_tokens": 7,
    "temperature": 0
  }'
{
  "id": "<string>",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 123,
      "logprobs": {
        "text_offset": [
          123
        ],
        "token_logprobs": [
          123
        ],
        "tokens": [
          "<string>"
        ],
        "top_logprobs": [
          {}
        ]
      },
      "text": "<string>"
    }
  ],
  "created": 123,
  "model": "<string>",
  "system_fingerprint": "<string>",
  "object": "text_completion",
  "usage": {
    "completion_tokens": 123,
    "prompt_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

x-portkey-api-key
string
header
required
x-portkey-virtual-key
string
header
required

Body

application/json

Response

200 - application/json
OK

Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).