GPTRouter, developed by Writesonic, is a software solution designed to facilitate the management of various large language models (LLMs) and image generation models. This tool aims to enhance the responsiveness and reliability of AI model interactions by offering features such as model independence, smart fallbacks, and automatic retries.
GPTRouter supports a variety of models for both language and image generation tasks:
Additional models and features are planned for future updates.
To begin using GPTRouter, users can either set up the server locally following detailed instructions provided in the documentation or use a preview deployment available online. Integration into applications can be achieved using the provided Python SDK, with JavaScript and other client libraries currently in development.
GPTRouter can be installed using pip or conda:
pip install gptrouter
conda install gptrouter -c conda-forge
Here is a basic example of using GPTRouter to generate content:
from gpt_router.client import GPTRouterClient
from gpt_router.models import ModelGenerationRequest, GenerationParams
from gpt_router.enums import ModelsEnum, ProvidersEnum
client = GPTRouterClient(base_url='your_base_url', api_key='your_api_key')
messages = [{"role": "user", "content": "Write me a short poem"}]
prompt_params = GenerationParams(messages=messages)
claude2_request = ModelGenerationRequest(
model_name=ModelsEnum.CLAUDE_INSTANT_12,
provider_name=ProvidersEnum.ANTHROPIC.value,
order=1,
prompt_params=prompt_params,
)
response = client.generate(ordered_generation_requests=[claude2_request])
print(response.choices[0].text)
Comprehensive documentation is available to guide users through installation, setup, and integration of GPTRouter. The documentation also provides detailed examples and troubleshooting tips.
GPTRouter welcomes contributions from the community. Interested developers can consult the Contribution Guidelines to understand how they can contribute to the project.
GPTRouter is a robust gateway for managing multiple AI models, ensuring that businesses and developers can maintain high availability and responsiveness in their AI-driven applications. With ongoing development and community support, GPTRouter continues to expand its capabilities and support for additional models.