Interface: ApiConfiguration
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
-
ApiConfiguration
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
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
>
Defined in
packages/modelfusion/src/core/api/ApiConfiguration.ts:35
Properties
retry
• Optional
Readonly
retry: RetryFunction
Defines how failed API calls should be retried.
Defined in
packages/modelfusion/src/core/api/ApiConfiguration.ts:40
throttle
• Optional
Readonly
throttle: ThrottleFunction
Defines how API calls should be rate limited.