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
-
↳
OpenAICompatibleApiConfiguration
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
Name | Type |
---|---|
path | string |
Returns
string
Inherited from
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
Name | Type | Description |
---|---|---|
params | HeaderParameters | Parameters that can be used to create the headers. |
Returns
Record
<string
, string
>
Inherited from
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
Defined in
packages/modelfusion/src/core/api/ApiConfiguration.ts:40
throttle
• Optional
Readonly
throttle: ThrottleFunction
Defines how API calls should be rate limited.