Modules@robinpath/openai

@robinpath/openai

0.1.1Public

OpenAI module for RobinPath.

@robinpath/openai

OpenAI module for RobinPath.

Category Functions Auth License

Why use this module?

The openai module lets you:

  • Send a chat completion request to OpenAI
  • Send a legacy completion request
  • Generate images using DALL-E
  • Edit an image using DALL-E with an optional mask
  • Create a variation of an existing image

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/openai

Quick Start

1. Set up credentials

openai.setApiKey "sk-..."

2. Send a chat completion request to OpenAI

openai.chat "Hello, how are you?" {"model": "gpt-4o"}

Available Functions

FunctionDescription
openai.setApiKeySet the OpenAI API key for authentication
openai.chatSend a chat completion request to OpenAI
openai.completeSend a legacy completion request
openai.generateImageGenerate images using DALL-E
openai.editImageEdit an image using DALL-E with an optional mask
openai.createImageVariationCreate a variation of an existing image
openai.transcribeTranscribe audio to text using Whisper
openai.translateTranslate audio to English text using Whisper
openai.speakConvert text to speech using TTS
openai.createEmbeddingGenerate text embeddings
openai.createModerationCheck text for content policy violations
openai.listModelsList all available OpenAI models
openai.getModelGet details of a specific model
openai.uploadFileUpload a file to OpenAI
openai.listFilesList uploaded files
openai.deleteFileDelete an uploaded file
openai.getFileContentGet the content of an uploaded file
openai.createFineTuneCreate a fine-tuning job
openai.listFineTunesList fine-tuning jobs
openai.getFineTuneGet details of a fine-tuning job
openai.cancelFineTuneCancel a running fine-tuning job
openai.createBatchCreate a batch processing request
openai.getBatchGet details of a batch request
openai.listBatchesList batch requests
openai.cancelBatchCancel a batch request

Examples

Send a chat completion request to OpenAI

openai.chat "Hello, how are you?" {"model": "gpt-4o"}

Send a legacy completion request

openai.complete "Once upon a time"

Generate images using DALL-E

openai.generateImage "A sunset over mountains" {"model": "dall-e-3", "size": "1024x1024"}

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/openai";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  openai.setApiKey "sk-..."
  openai.chat "Hello, how are you?" {"model": "gpt-4o"}
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.1latestyesterday
Install
$ robinpath install @robinpath/openai
Version0.1.1
LicenseMIT
Unpacked Size9.4 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

ai