POST
/
v4
/
models
/
{model_deployment_id}
/
completions
import SGPClient from 'sgp';

const client = new SGPClient({
  apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});

async function main() {
  const completionResponse = await client.models.completions.create('model_deployment_id', {
    prompt: 'prompt',
  });

  console.log(completionResponse.completions);
}

main();
{
  "finish_reason": "<string>",
  "prompt_tokens": 0,
  "response_tokens": 0,
  "completions": [
    [
      "<any>"
    ]
  ],
  "choices": [
    {
      "index": 123,
      "logprobs": {
        "content": [
          {
            "token": "<string>",
            "bytes": [
              123
            ],
            "logprob": 123,
            "top_logprobs": [
              {
                "token": "<string>",
                "bytes": [
                  123
                ],
                "logprob": 123
              }
            ]
          }
        ]
      }
    }
  ]
}

Authorizations

x-api-key
string
header
required

Headers

x-selected-account-id
string

Path Parameters

model_deployment_id
string
required

Body

application/json

Response

200
application/json

Successful Response

The response is of type object.