import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: 'My API Key',
});
const completionV5 = await client.beta.completions.create({ model: 'model', prompt: 'string' });
console.log(completionV5.id);
{
"id": "<string>",
"object": "text_completion",
"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>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123,
"completion_tokens_details": {
"accepted_prediction_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123,
"rejected_prediction_tokens": 123
},
"prompt_tokens_details": {
"audio_tokens": 123,
"cached_tokens": 123
}
}
}
import SGPClient from 'sgp';
const client = new SGPClient({
apiKey: 'My API Key',
});
const completionV5 = await client.beta.completions.create({ model: 'model', prompt: 'string' });
console.log(completionV5.id);
{
"id": "<string>",
"object": "text_completion",
"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>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123,
"completion_tokens_details": {
"accepted_prediction_tokens": 123,
"audio_tokens": 123,
"reasoning_tokens": 123,
"rejected_prediction_tokens": 123
},
"prompt_tokens_details": {
"audio_tokens": 123,
"cached_tokens": 123
}
}
}
Successful Response
The response is of type object
.