Installation
First, install the OpenAI SDK and import the package. Then, create a client and configure it with the Compatibility API base URL and your Seekr API key.Basic chat completions
Here’s a basic example using the Chat Completions API:Chat with streaming
To stream the response, set the stream parameter toTrue.
State management
For state management, use themessages parameter to build the conversation history.
You can include a system message via the developer role and the multiple chat turns between the user and assistant.
Tool use (function calling)
You can utilize the tool use feature by passing a list of tools to the tools parameter in the API call. This one creates a custom unit conversion tool that can be configured dynamically.Supported parameters
The following is the list supported parameters in the Compatibility API, including those that are not explicitly demonstrated in the examples above:- model
- messages
- stream
- temperature
- logprobs
- top_logprobs
- max_tokens
- stop
- top_p
- frequency_penalty
- presence_penalty
Unsupported parameters
The following parameters are not supported in the Compatibility API:- tool_choice
- store
- reasoning_effort
- metadata
- logit_bias
- max_completion_tokens
- n
- modalities
- prediction
- audio
- service_tier
- stream_options
- parallel_tool_calls
- user