Attributes
Extremely Popular
Includes Deno configuration
Repository
Current version released
2 years ago
Dependencies
std
Versions
- v4.67.3Latest
- v4.67.2
- v4.67.1
- v4.67.0
- v4.66.1
- v4.64.0
- v4.62.1
- v4.62.0
- v4.61.1
- v4.61.0
- v4.61.0
- v4.60.1
- v4.60.0
- v4.59.0
- v4.58.2
- v4.58.1
- v4.58.0
- v4.57.3
- v4.57.2
- v4.57.1
- v4.57.0
- v4.56.2
- v4.56.0
- v4.55.9
- v4.55.8
- v4.55.7
- v4.55.6
- v4.55.5
- v4.55.5
- v4.55.4
- v4.55.4
- v4.55.3
- v4.55.2
- v4.55.1
- v4.55.0
- v4.54.0
- v4.53.2
- v4.53.1
- v4.53.1
- v4.53.0
- v4.52.7
- v4.52.6
- v4.52.5
- v4.52.4
- v4.52.4
- v4.52.3
- v4.52.3
- v4.52.2
- v4.52.1
- v4.52.0
- v4.52.0
- v4.51.0
- v4.51.0
- v4.50.0
- v4.50.0
- v4.49.1
- v4.49.1
- v4.49.0
- v4.48.3
- v4.48.2
- v4.48.1
- v4.48.1
- v4.47.3
- v4.47.1
- v4.47.0
- v4.46.1
- v4.46.0
- v4.45.0
- v4.44.0
- v4.43.0
- v4.42.0
- v4.41.1
- v4.41.0
- v4.40.2
- v4.40.2
- v4.40.1
- v4.40.0
- v4.39.1
- v4.39.1
- v4.39.0
- v4.38.5
- v4.38.4
- v4.38.3
- v4.38.2
- v4.38.2
- v4.38.1
- v4.38.1
- v4.38.0
- v4.37.1
- v4.37.0
- v4.36.0
- v4.34.0
- v4.33.1
- v4.33.0
- v4.32.2
- v4.32.1
- v4.32.1
- v4.32.0
- v4.31.0
- v4.30.0
- v4.29.2
- v4.29.1
- v4.29.0
- v4.29.0
- v4.28.5
- v4.28.4
- v4.28.4
- v4.28.0
- v4.27.1
- v4.27.0
- v4.26.1
- v4.26.0
- v4.25.0
- v4.25.0
- v4.24.7
- v4.24.6
- v4.24.5
- v4.24.4
- v4.24.4
- v4.24.3
- v4.24.3
- v4.24.2
- v4.24.1
- v4.24.0
- v4.23.0
- v4.23.0
- v4.22.1
- v4.22.0
- v4.21.0
- v4.20.1
- v4.20.0
- v4.19.1
- v4.19.0
- v4.16.1
- v4.15.3
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.1
- v1.2.0
- v1.1.0
Deno wrapper for the Open Ai API
Usage
Completion
import { OpenAI } from "https://deno.land/x/openai/mod.ts";
const openAI = new OpenAI("YOUR_API_KEY");
const completion = await openAI.createCompletion({
model: "davinci",
prompt: "The meaning of life is",
});
console.log(completion.choices);
Chat Completion
import { OpenAI } from "https://deno.land/x/openai/mod.ts";
const openAI = new OpenAI("YOUR_API_KEY");
const chatCompletion = await openAI.createChatCompletion({
model: "gpt-3.5-turbo",
messages: [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Who won the world series in 2020?" },
{
"role": "assistant",
"content": "The Los Angeles Dodgers won the World Series in 2020.",
},
{ "role": "user", "content": "Where was it played?" },
],
});
console.log(chatCompletion);
Image
import { OpenAI } from "https://deno.land/x/openai/mod.ts";
const openAI = new OpenAI("YOUR_API_KEY");
const image = await openAI.createImage({
prompt: "A unicorn in space",
});
console.log(image);
Edit
import { OpenAI } from "https://deno.land/x/openai/mod.ts";
const openAI = new OpenAI("YOUR_API_KEY");
const edit = await openAI.createEdit({
model: "text-davinci-edit-001",
input: "What day of the wek is it?",
instruction: "Fix the spelling mistakes",
});
console.log(edit);
Image Edit
import { OpenAI } from "https://deno.land/x/openai/mod.ts";
const openAI = new OpenAI("YOUR_API_KEY");
const imageEdit = await openAI.createImageEdit({
image: "@otter.png",
mask: "@mask.png",
prompt: "A cute baby sea otter wearing a beret",
n: 2,
size: "1024x1024",
});
console.log(imageEdit);
Image Variation
import { OpenAI } from "https://deno.land/x/openai/mod.ts";
const openAI = new OpenAI("YOUR_API_KEY");
const imageVariation = await openAI.createImageVariation({
image: "@otter.png",
n: 2,
size: "1024x1024",
});
console.log(imageVariation);
Maintainers
- Dean Srebnik (@load1n9)
- Lino Le Van (@lino-levan)
License
MIT