custom_endpoints
create_custom_endpoint
Create a custom endpoint for API calls.
Arguments:
name
- Alias for the custom endpoint. This will be the name used to call the endpoint.url
- Base URL of the endpoint being called. Must support the OpenAI format.key_name
- Name of the API key that will be passed as part of the query.model_name
- Name passed to the custom endpoint as model name. If not specified, it will default to the endpoint alias.provider
- If the custom endpoint is for a fine-tuned model which is hosted directly via one of the supported providers,api_key
- If specified, unify API key to be used. Defaults to the value in theUNIFY_KEY
environment variable.
Returns:
A dictionary containing the response from the API.
Raises:
requests.HTTPError
: If the API request fails.KeyError
: If the UNIFY_KEY is not set and no api_key is provided.