Many providers like Together and Grow support the OpenAI API format. Use the OpenAILike LLM to access them by replacing the base_url.

Example

from os import getenv
from phi.assistant import Assistant
from phi.llm.openai.like import OpenAILike

assistant = Assistant(
    llm=OpenAILike(
        model="mistralai/Mixtral-8x7B-Instruct-v0.1",
        api_key=getenv("TOGETHER_API_KEY"),
        base_url="https://api.together.xyz/v1",
    )
)
assistant.print_response('Share a 2 sentence horror story.', markdown=True)

Params

model
str

The name of the model to be used for generating responses.

api_key
str

The API key for authenticating requests to the service.

base_url
str

The base URL for making API requests to the service.

OpenAILike also support all the params of OpenAIChat