__init__
endpoint
- Endpoint name in OpenAI API format:model
- Name of the model. Should only be set if endpoint is not set.provider
- Name of the provider. Should only be set if endpoint is not set.system_message
- An optional string containing the system message. Thismessages
- A list of messages comprising the conversation so far. This willfrequency_penalty
- Number between -2.0 and 2.0. Positive values penalize newlogit_bias
- Modify the likelihood of specified tokens appearing in thelogprobs
- Whether to return log probabilities of the output tokens or not.top_logprobs
- An integer between 0 and 20 specifying the number of mostmax_completion_tokens
- The maximum number of tokens that can be generated inn
- How many chat completion choices to generate for each input message. Notepresence_penalty
- Number between -2.0 and 2.0. Positive values penalize newresponse_format
- An object specifying the format that the model must output.seed
- If specified, a best effort attempt is made to samplestop
- Up to 4 sequences where the API will stop generating further tokens.stream
- If True, generates content as a stream. If False, generates contentstream_options
- Options for streaming response. Only set this when you setstream
- true.temperature
- What sampling temperature to use, between 0 and 2.top_p
- An alternative to sampling with temperature, called nucleus sampling,tools
- A list of tools the model may call. Currently, only functions aretool_choice
- Controls which (if any) tool is called by theparallel_tool_calls
- Whether to enable parallel function calling during tooluse_custom_keys
- Whether to use custom API keys or our unified API keystags
- Arbitrary number of tags to classify this API query as needed. Helpfuldrop_params
- Whether or not to drop unsupported OpenAI params by theregion
- A string used to represent the region where the endpoint islog_query_body
- Whether to log the contents of the query json body.log_response_body
- Whether to log the contents of the response json body.stateful
- Whether the conversation history is preserved within the messagesreturn_full_completion
- If False, only return the message contenttraced
- Whether to trace the generate method.cache
- If True, then the arguments will be stored in a local cache file, andextra_headers
- Additional “passthrough” headers for the request which areextra_query
- Additional “passthrough” query parameters for the request whichkwargs
- Additional “passthrough” JSON properties for the body of the
UnifyError
: If the API key is missing.
properties
cache
drop_params
endpoint
extra_body
extra_headers
extra_query
frequency_penalty
log_query_body
log_response_body
logit_bias
logprobs
max_completion_tokens
messages
model
n
parallel_tool_calls
presence_penalty
provider
reasoning_effort
region
response_format
return_full_completion
seed
service_tier
stateful
stop
stream
stream_options
system_message
tags
temperature
tool_choice
tools
top_logprobs
top_p
traced
use_custom_keys
setters
set_cache
value
- The default cache bool.
set_cache_backend
value
- The default cache backend.
set_drop_params
value
- The default drop params bool.
set_endpoint
value
- The endpoint name.
set_extra_body
value
- The default extra body.
set_extra_headers
value
- The default extra headers.
set_extra_query
value
- The default extra query.
set_frequency_penalty
value
- The default frequency penalty.
set_log_query_body
value
- The default log query body bool.
set_log_response_body
value
- The default log response body bool.
set_logit_bias
value
- The default logit bias.
set_logprobs
value
- The default logprobs.
set_max_completion_tokens
value
- The default max tokens.
set_messages
value
- The default messages.
set_model
value
- The model name.
set_n
value
- The default n value.
set_parallel_tool_calls
value
- The default parallel tool calls bool.
set_presence_penalty
value
- The default presence penalty.
set_provider
value
- The provider name.
set_reasoning_effort
value
- The default reasoning effort.
set_region
value
- The default region.
set_response_format
value
- The default response format.
set_return_full_completion
value
- The default return full completion bool.
set_seed
value
- The default seed value.
set_service_tier
value
- The default service tier.
set_stateful
value
- The default stateful bool.
set_stop
value
- The default stop value.
set_stream
value
- The default stream bool.
set_stream_options
value
- The default stream options.
set_system_message
value
- The default system message.
set_tags
value
- The default tags.
set_temperature
value
- The default temperature.
set_tool_choice
value
- The default tool choice.
set_tools
value
- The default tools.
set_top_logprobs
value
- The default top logprobs.
set_top_p
value
- The default top p value.
set_traced
value
- The default traced bool.
set_use_custom_keys
value
- The default use custom keys bool.
methods
append_messages
value
- The messages to append to the default.
copy
generate
user_message
- A string containing the user message.system_message
- An optional string containing the system message. Thismessages
- A list of messages comprising the conversation so far, orfrequency_penalty
- Number between -2.0 and 2.0. Positive values penalize newlogit_bias
- Modify the likelihood of specified tokens appearing in thelogprobs
- Whether to return log probabilities of the output tokens or not.top_logprobs
- An integer between 0 and 20 specifying the number of mostmax_completion_tokens
- The maximum number of tokens that can be generated inn
- How many chat completion choices to generate for each input message. Notepresence_penalty
- Number between -2.0 and 2.0. Positive values penalize newresponse_format
- An object specifying the format that the model must output.seed
- If specified, a best effort attempt is made to samplestop
- Up to 4 sequences where the API will stop generating further tokens.stream
- If True, generates content as a stream. If False, generates contentstream_options
- Options for streaming response. Only set this when you setstream
- true.temperature
- What sampling temperature to use, between 0 and 2.top_p
- An alternative to sampling with temperature, called nucleus sampling,tools
- A list of tools the model may call. Currently, only functions aretool_choice
- Controls which (if any) tool is called by theparallel_tool_calls
- Whether to enable parallel function calling during tooluse_custom_keys
- Whether to use custom API keys or our unified API keystags
- Arbitrary number of tags to classify this API query as needed. Helpfuldrop_params
- Whether or not to drop unsupported OpenAI params by theregion
- A string used to represent the region where the endpoint islog_query_body
- Whether to log the contents of the query json body.log_response_body
- Whether to log the contents of the response json body.stateful
- Whether the conversation history is preserved within the messagesreturn_full_completion
- If False, only return the message contentcache
- If True, then the arguments will be stored in a local cache file, andextra_headers
- Additional “passthrough” headers for the request which areextra_query
- Additional “passthrough” query parameters for the request whichkwargs
- Additional “passthrough” JSON properties for the body of the
UnifyError
: If an error occurs during content generation.
get_credit_balance
BadRequestError
- If there was an HTTP error.ValueError
- If there was an error parsing the JSON response.
json
reset_all
reset_frequency_penalty
reset_logit_bias
reset_logprobs
reset_max_completion_tokens
reset_messages
reset_n
reset_parallel_tool_calls
reset_presence_penalty
reset_reasoning_effort
reset_response_format
reset_seed
reset_service_tier
reset_stop
reset_stream
reset_stream_options
reset_system_message
reset_temperature
reset_tool_choice
reset_tools
reset_top_logprobs
reset_top_p
to_async_client
AsyncUnify
instance), with the
exact same configuration as this synchronous (Unify
) client.
Returns:
An AsyncUnify
instance with the same configuration as this Unify
instance.