kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
pull/643/head^2
rodzic
ac76b5098b
commit
419c0a44a7
|
@ -5,9 +5,9 @@ import type { DeepNullable, KyInstance } from '../types.js'
|
|||
import { assert, delay, getEnv, throttleKy } from '../utils.js'
|
||||
|
||||
export namespace clearbit {
|
||||
// Allow up to 20 requests per minute by default.
|
||||
// Allow up to 600 requests per minute by default.
|
||||
export const throttle = pThrottle({
|
||||
limit: 20,
|
||||
limit: 600,
|
||||
interval: 60 * 1000
|
||||
})
|
||||
|
||||
|
@ -535,7 +535,8 @@ export class ClearbitClient {
|
|||
this.ky = throttledKy.extend({
|
||||
timeout: timeoutMs,
|
||||
headers: {
|
||||
Authorization: `Basic ${Buffer.from(`${apiKey}:`).toString('base64')}`
|
||||
// Authorization: `Basic ${Buffer.from(`${apiKey}:`).toString('base64')}`
|
||||
Authorization: `Bearer ${apiKey}`
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -546,7 +547,6 @@ export class ClearbitClient {
|
|||
searchParams: { ...options }
|
||||
})
|
||||
.json<clearbit.CompanyResponse>()
|
||||
.catch((_) => undefined)
|
||||
}
|
||||
|
||||
async companySearch(options: clearbit.CompanySearchOptions) {
|
||||
|
@ -642,7 +642,7 @@ export class ClearbitClient {
|
|||
.catch((_) => undefined)
|
||||
}
|
||||
|
||||
async revealCompanyFromIp(ip: string) {
|
||||
async revealCompanyFromIP(ip: string) {
|
||||
return this.ky
|
||||
.get('https://reveal.clearbit.com/v1/companies/find', {
|
||||
searchParams: { ip }
|
||||
|
|
|
@ -19,7 +19,10 @@ export class DexaClient {
|
|||
timeoutMs?: number
|
||||
ky?: KyInstance
|
||||
} = {}) {
|
||||
assert(apiKey, 'DexaClient missing required "apiKey"')
|
||||
assert(
|
||||
apiKey,
|
||||
'DexaClient missing required "apiKey" (defaults to "DEXA_API_KEY")'
|
||||
)
|
||||
|
||||
this.apiKey = apiKey
|
||||
this.apiBaseUrl = apiBaseUrl
|
||||
|
|
|
@ -351,7 +351,10 @@ export class DiffbotClient {
|
|||
throttle?: boolean
|
||||
ky?: KyInstance
|
||||
} = {}) {
|
||||
assert(apiKey, `DiffbotClient missing required "apiKey"`)
|
||||
assert(
|
||||
apiKey,
|
||||
`DiffbotClient missing required "apiKey" (defaults to "DIFFBOT_API_KEY")`
|
||||
)
|
||||
|
||||
this.apiKey = apiKey
|
||||
this.apiBaseUrl = apiBaseUrl
|
||||
|
|
|
@ -143,7 +143,10 @@ export class ExaClient {
|
|||
apiBaseUrl?: string
|
||||
ky?: KyInstance
|
||||
} = {}) {
|
||||
assert(apiKey, 'ExaClient missing required "apiKey"')
|
||||
assert(
|
||||
apiKey,
|
||||
'ExaClient missing required "apiKey" (defaults to "EXA_API_KEY")'
|
||||
)
|
||||
|
||||
this.apiKey = apiKey
|
||||
this.apiBaseUrl = apiBaseUrl
|
||||
|
|
|
@ -449,7 +449,10 @@ export class PeopleDataLabsClient {
|
|||
throttle?: boolean
|
||||
ky?: KyInstance
|
||||
} = {}) {
|
||||
assert(apiKey, 'PeopleDataLabsClient missing required "apiKey"')
|
||||
assert(
|
||||
apiKey,
|
||||
'PeopleDataLabsClient missing required "apiKey" (defaults to "PEOPLE_DATA_LABS_API_KEY")'
|
||||
)
|
||||
|
||||
this.apiKey = apiKey
|
||||
this.apiBaseUrl = apiBaseUrl
|
||||
|
|
|
@ -273,7 +273,10 @@ export class PerigonClient {
|
|||
timeoutMs?: number
|
||||
ky?: KyInstance
|
||||
} = {}) {
|
||||
assert(apiKey, 'Error PerigonClient missing required "apiKey"')
|
||||
assert(
|
||||
apiKey,
|
||||
'PerigonClient missing required "apiKey" (defaults to "PERIGON_API_KEY")'
|
||||
)
|
||||
|
||||
this.apiKey = apiKey
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import { assert, getEnv, throttleKy } from '../utils.js'
|
|||
|
||||
// All proxycurl types are auto-generated from their openapi spec
|
||||
export namespace proxycurl {
|
||||
// Allow up to 1500 requests per minute by default.
|
||||
// Allow up to 300 requests per minute by default (enforced at 5 minute intervals).
|
||||
export const throttle = pThrottle({
|
||||
limit: 1500,
|
||||
interval: 5 * 60 * 1000
|
||||
|
|
|
@ -649,7 +649,10 @@ export class SerpAPIClient extends AIFunctionsProvider {
|
|||
apiBaseUrl?: string
|
||||
ky?: KyInstance
|
||||
} & serpapi.ClientParams = {}) {
|
||||
assert(apiKey, 'Error SerpAPIClient missing required "apiKey"')
|
||||
assert(
|
||||
apiKey,
|
||||
'SerpAPIClient missing required "apiKey" (defaults to "SERPAPI_API_KEY")'
|
||||
)
|
||||
super()
|
||||
|
||||
this.apiKey = apiKey
|
||||
|
|
|
@ -227,7 +227,7 @@ export class SerperClient extends AIFunctionsProvider {
|
|||
} & serper.ClientParams = {}) {
|
||||
assert(
|
||||
apiKey,
|
||||
'SerperClient missing required "apiKey" (defaults to "SERPER_API_KEY" env var)'
|
||||
'SerperClient missing required "apiKey" (defaults to "SERPER_API_KEY")'
|
||||
)
|
||||
|
||||
super()
|
||||
|
|
Ładowanie…
Reference in New Issue