Skip to main content

Interface: OpenAICompatibleApiConfiguration

Settings for how to call an API, e.g. OpenAI.

This interfaces enables creating pre-defined API configuration for certain API (e.g., OpenAI), pre-defined proxy configurations (e.g. Helicone OpenAI), and fully custom setups (e.g. your own internal OpenAI proxy with custom headers).

Hierarchy

Implemented by

Methods

assembleUrl

assembleUrl(path): string

Creates a full URL given a inner path.

The inner path always starts with a slash, e.g. /generate.

Parameters

NameType
pathstring

Returns

string

Inherited from

ApiConfiguration.assembleUrl

Defined in

packages/modelfusion/src/core/api/ApiConfiguration.ts:25


headers

headers(params): Record<string, string>

Returns the headers that should be included in every request to the API. This is intended for authentication headers and proxy settings.

The model may add additional headers, in particular "Content-Type"."

Parameters

NameTypeDescription
paramsHeaderParametersParameters that can be used to create the headers.

Returns

Record<string, string>

Inherited from

ApiConfiguration.headers

Defined in

packages/modelfusion/src/core/api/ApiConfiguration.ts:35

Properties

provider

Optional provider: `openaicompatible-${string}` | "openaicompatible"

Defined in

packages/modelfusion/src/model-provider/openai-compatible/OpenAICompatibleApiConfiguration.ts:8


retry

Optional Readonly retry: RetryFunction

Defines how failed API calls should be retried.

Inherited from

ApiConfiguration.retry

Defined in

packages/modelfusion/src/core/api/ApiConfiguration.ts:40


throttle

Optional Readonly throttle: ThrottleFunction

Defines how API calls should be rate limited.

Inherited from

ApiConfiguration.throttle

Defined in

packages/modelfusion/src/core/api/ApiConfiguration.ts:45