GPTRouter Examples
This contains a collection of Python examples demonstrating the use of the GPTRouter API for text generation with various use cases and configurations.
Getting Started
Prerequisites
- Getting The Server Running
You can try out the GPTRouter using our PythonSDK or via the API Docs meanwhile we are working on JS and other Clients and are looking for contributors
Using the Python SDK
- Installing the SDK
pip install gptrouter
Or with conda:
conda install gptrouter -c conda-forge
Create a
.env
file based on the template:GPT_ROUTER_API_TOKEN=
Edit the
.env
file and fill in yourGPT_ROUTER_API_TOKEN
:GPT_ROUTER_API_TOKEN="your_api_token_here"
Examples Overview
Below is a link of each example included in the repository:
Example | Generation Type | Description |
---|---|---|
Async Non Streaming | Text | here 🚗 |
Async Streaming | Text | here 🚁 |
Sync Streaming | Text | here 🚙 |
Sync Non Streaming | Text | here ✈️ |
Image Generations | Audio | Examples Coming Soon |
Running the Examples
After setting up your .env
with the API token and installing the necessary dependencies, you can run each example script using the python
command. For instance:
python async_non_streaming.py
Please note that the output will vary based on the input provided and the model and parameters specified in each example.