Request Parameters
This page provides a detailed description of the various parameters that can be included in your Infuzu API request. Understanding these parameters will help you customize your queries and make the most out of the Infuzu API's capabilities.
Basic Parameters
messages (Required)
The core of any Infuzu API request is the messages
array. This parameter holds the conversation context, allowing the model to generate appropriate responses based on the provided history.
Each message object in the array should have the following structure:
role: Specifies the sender's role. Must be one of:
"system"
,"user"
or"assistant"
.content (optional): The text content of the message.
content_parts (optional): Used for more advanced configurations like image URLs or input audio, specified as a list.
Message Object Example:
model (Optional)
Specifies the model to be used for generating the completion. It can be:
A simple string indicating the model name (e.g.,
"deepinfra.deepseek-r1"
).An object containing detailed settings and constraints.
Simple Model Example:
Model Configuration
Advanced configurations allow you to fine-tune which model(s) to use and include additional weighting factors. This can be done using the InfuzuModelParams
object for the model
parameter.
InfuzuModelParams
Parameter | Type | Description |
---|---|---|
llms | list of strings | Array of model names to specifically include |
exclude_llms | list of strings | Array of model names to explicitly exclude |
weights | ModelWeights | Object containing custom weights for price, error, start, and end latency |
imsn | int | Number of model suggestions to consider |
max_input_cost | float | Maximum allowed cost per million character for input |
max_output_cost | float | Maximum allowed cost per million character for output |
ModelWeights
Used to set custom weights for various parameters affecting model selection.
Parameter | Type | Description |
---|---|---|
price | float (0-1000) | Custom weight for price |
error | float (0-1000) | Custom weight for error rates |
start_latency | float (0-1000) | Custom weight for start latency |
end_latency | float (0-1000) | Custom weight for end latency |
Example of InfuzuModelParams:
Advanced Configuration using InfuzuModelParams
Using the InfuzuModelParams
object allows for in-depth customization of how the Infuzu API selects the model for your requests. Below descriptions detail each field and its usage.
llms
Specify a list of models to prefer in the selection process.
exclude_llms
Specify models that should be excluded from consideration.
weights
Customize the importance of factors such as price, error rates, and latency. Quality determined by IMS
is weighted by default at 100. You can set the weights of all other considerations to your relative preference.
imsn
The number of model suggestions to consider from the Intelligent Model Selection (IMS).
max_input_cost & max_output_cost
Set cost thresholds per million input and output characters.
Examples
Text Completion
Here is a basic example of a text completion request using cURL and the Infuzu Python library.
Using cURL:
Using Python:
Custom Model Selection
Using InfuzuModelParams
to customize model selection based on preference and cost constraints.
Using cURL:
Using Python:
Advanced Weighting
Custom weighting factors for price, error rate, and latency.
Using cURL:
Using Python:
With these parameters and examples, you can tailor your API requests to your specific needs, optimizing for cost, performance, and model preferences. By understanding and using these parameters effectively, you'll be able to fully leverage the capabilities of the Infuzu API.