Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/openai

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/openai - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

6

./dist/index.js

@@ -768,2 +768,4 @@ "use strict";

this.organization = options.organization;
this.project = options.project;
this.headers = options.headers;
}

@@ -780,3 +782,5 @@ get baseConfig() {

})}`,
"OpenAI-Organization": this.organization
"OpenAI-Organization": this.organization,
"OpenAI-Project": this.project,
...this.headers
})

@@ -783,0 +787,0 @@ };

103

dist/index.d.ts

@@ -95,38 +95,2 @@ import { LanguageModelV1 } from '@ai-sdk/provider';

/**
* @deprecated Use `createOpenAI` instead.
*/
declare class OpenAI {
/**
* Base URL for the OpenAI API calls.
*/
readonly baseURL: string;
readonly apiKey?: string;
readonly organization?: string;
/**
* Creates a new OpenAI provider instance.
*/
constructor(options?: {
/**
* Base URL for the OpenAI API calls.
*/
baseURL?: string;
/**
* @deprecated Use `baseURL` instead.
*/
baseUrl?: string;
/**
* API key for authenticating requests.
*/
apiKey?: string;
/**
* Organization ID.
*/
organization?: string;
});
private get baseConfig();
chat(modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): OpenAIChatLanguageModel;
completion(modelId: OpenAICompletionModelId, settings?: OpenAICompletionSettings): OpenAICompletionLanguageModel;
}
interface OpenAIProvider {

@@ -138,24 +102,33 @@ (modelId: 'gpt-3.5-turbo-instruct', settings?: OpenAICompletionSettings): OpenAICompletionLanguageModel;

}
/**
* Create an OpenAI provider.
*/
declare function createOpenAI(options?: {
interface OpenAIProviderSettings {
/**
* Base URL for the OpenAI API calls.
*/
Base URL for the OpenAI API calls.
*/
baseURL?: string;
/**
* @deprecated Use `baseURL` instead.
*/
@deprecated Use `baseURL` instead.
*/
baseUrl?: string;
/**
* API key for authenticating requests.
*/
API key for authenticating requests.
*/
apiKey?: string;
/**
* Organization ID.
*/
OpenAI Organization.
*/
organization?: string;
}): OpenAIProvider;
/**
OpenAI project.
*/
project?: string;
/**
Custom headers to include in the requests.
*/
headers?: Record<string, string>;
}
/**
Create an OpenAI provider instance.
*/
declare function createOpenAI(options?: OpenAIProviderSettings): OpenAIProvider;
/**
* Default OpenAI provider instance.

@@ -165,2 +138,32 @@ */

export { OpenAI, type OpenAIProvider, createOpenAI, openai };
/**
@deprecated Use `createOpenAI` instead.
*/
declare class OpenAI {
/**
Base URL for the OpenAI API calls.
*/
readonly baseURL: string;
readonly apiKey?: string;
/**
OpenAI Organization.
*/
readonly organization?: string;
/**
OpenAI project.
*/
readonly project?: string;
/**
Custom headers to include in the requests.
*/
readonly headers?: Record<string, string>;
/**
* Creates a new OpenAI provider instance.
*/
constructor(options?: OpenAIProviderSettings);
private get baseConfig();
chat(modelId: OpenAIChatModelId, settings?: OpenAIChatSettings): OpenAIChatLanguageModel;
completion(modelId: OpenAICompletionModelId, settings?: OpenAICompletionSettings): OpenAICompletionLanguageModel;
}
export { OpenAI, type OpenAIProvider, type OpenAIProviderSettings, createOpenAI, openai };

@@ -768,2 +768,4 @@ "use strict";

this.organization = options.organization;
this.project = options.project;
this.headers = options.headers;
}

@@ -780,3 +782,5 @@ get baseConfig() {

})}`,
"OpenAI-Organization": this.organization
"OpenAI-Organization": this.organization,
"OpenAI-Project": this.project,
...this.headers
})

@@ -783,0 +787,0 @@ };

{
"name": "@ai-sdk/openai",
"version": "0.0.3",
"version": "0.0.4",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -19,9 +19,22 @@ # Vercel AI SDK - OpenAI Provider

```ts
import { createOpenAI } from '@ai-sdk/openai'
import { createOpenAI } from '@ai-sdk/openai';
const openai = createOpenAI({
baseURL: '', // optional base URL for proxies etc.
apiKey: '' // optional API key, default to env property OPENAI_API_KEY
organization: '' // optional organization
})
// optional base URL for proxies etc.
baseURL: '',
// optional API key, default to env property OPENAI_API_KEY
apiKey: '',
// optional OpenAI organization:
organization: '',
// optional OpenAI project:
project: '',
// optional custom headers:
headers: {
'custom-header': 'value',
},
});
```

@@ -28,0 +41,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc