Skip to main content
Home

latest

A tiny (1.18kB), tree-shakeable OpenAI client. Optionally supports response streaming in all JavaScript runtimes.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
82%
Published
6 months ago (0.0.8)
type alias Completion

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

Properties

A unique identifier for the completion.

choices: Array<CompletionChoice>

The list of completion choices the model generated for the input prompt.

The Unix timestamp (in seconds) of when the completion was created.

model: ModelName

The model used for completion.

object: "text_completion"

The object type, which is always "text_completion"

This fingerprint represents the backend configuration that the model runs with.

Can be used in conjunction with the seed request parameter to understand when backend changes have been made that might impact determinism.

optional
usage: CompletionUsage

Usage statistics for the completion request.

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@agent/openai

Import symbol

import { Completion } from "@agent/openai";
or

Import directly with a jsr specifier

import { Completion } from "jsr:@agent/openai";

Add Package

pnpm i jsr:@agent/openai
or (using pnpm 10.8 or older)
pnpm dlx jsr add @agent/openai

Import symbol

import { Completion } from "@agent/openai";

Add Package

yarn add jsr:@agent/openai
or (using Yarn 4.8 or older)
yarn dlx jsr add @agent/openai

Import symbol

import { Completion } from "@agent/openai";

Add Package

vlt install jsr:@agent/openai

Import symbol

import { Completion } from "@agent/openai";

Add Package

npx jsr add @agent/openai

Import symbol

import { Completion } from "@agent/openai";

Add Package

bunx jsr add @agent/openai

Import symbol

import { Completion } from "@agent/openai";