Skip to content

OpenAI compatibility

The kluster.ai API is compatible with OpenAI's API and SDKs, allowing seamless integration into your existing applications.

If you already have an application running with the OpenAI client library, you can easily switch to kluster.ai's API with minimal changes. This ensures a smooth transition without the need for significant refactoring or rework.

Configuring OpenAI to use kluster.ai's API

To start using kluster.ai with OpenAI's client libraries, set your API key and change the base URL to https://api.kluster.ai/v1:

from openai import OpenAI
import json

client = OpenAI(
    base_url="https://api.kluster.ai/v1",
    api_key="INSERT_API_KEY",  # Replace with your actual API key
)

Unsupported OpenAI features

While kluster.ai's API is largely compatible with OpenAI's, the following sections outline the specific features and fields that are currently unsupported.

Chat completions endpoint

When creating a chat completion via the POST https://api.kluster.ai/v1/chat/completions endpoint, the following request parameters are not supported:

  • messages[].name - attribute in system, user, and assistant type message objects
  • messages[].refusal - attribute in assistant type message objects
  • messages[].audio - attribute in assistant type message objects
  • messages[].tool_calls - attribute in assistant type message objects
  • store
  • n
  • modalities
  • response_format
  • service_tier
  • stream_options
  • tools
  • tool_choice
  • parallel_tool_calls

The following request parameters are deprecated:

  • messages[].function_call - attribute in assistant type message objects
  • max_tokens - use max_completion_tokens instead
  • function_call
  • functions

For more information on these parameters, refer to OpenAI's API documentation on creating chat completions.

Chat completion object

The following fields of the chat completion object are not supported:

  • system_fingerprint
  • usage.completion_tokens_details
  • usage.prompt_tokens_details

For more information on these parameters, refer to OpenAI's API documentation on the chat completion object.