Skip to main content

Wrapper library for using **DeepSeek** with **openrouter.ai**

Project description

Project generated with PyScaffold

|

openrouter-manager

openrouter-manager is a wrapper library for using DeepSeek with openrouter.ai, facilitating integration with language models through a simple and efficient API.

Main Features

  • Wrapper for DeepSeek using openrouter.ai.

  • Easy-to-use singleton class AiAgent.

  • Allows defining dynamic prompts with variables.

  • Configuration via environment variables.

Installation

It is recommended to install openrouter-manager in a virtual environment to avoid dependency conflicts:

pip install openrouter-manager

Requirements

To use this library, the following environment variables must be set:

  • AIAGENT_API_KEY: API Key for openrouter.ai.

  • AIAGENT_API_URL: URL for the openrouter.ai API

  • AIAGENT_LLM_MODEL: The model to use, e.g., deepseek/deepseek-chat-v3-0324:free.

  • AIAGENT_PROMPT_FILE: (Optional) Path to the text file containing the prompt to send to the LLM.

  • AIAGENT_PROMPT_FOLDER: (Optional) Path to the folder containing prompt files. If not set, the default is the current working directory.

At least one of the optional variables must be set. If the variable is the prompt folder, it must contain at least one .prompt file.

Example configuration in a .env file:

AIAGENT_API_KEY="your_api_key_here"
AIAGENT_PROMPT_FILE="path/to/prompt_file.txt"
AIAGENT_PROMPT_FOLDER="path/to/"
AIAGENT_API_URL="https://openrouter.ai/api/v1/chat/completions"
AIAGENT_LLM_MODEL="deepseek/deepseek-chat-v3-0324:free"

Model Reference

To explore available models and their corresponding URLs, visit [https://openrouter.ai/deepseek](https://openrouter.ai/deepseek).

Usage

To use openrouter-manager, first instantiate AiAgent and then call the resolve method, providing the necessary variables to populate the prompt:

from openrouter_manager import AiAgent

# Get the singleton instance of the agent
agent = AiAgent()

# Resolve the prompt with dynamic variables
response = agent.resolve({"name": "John", "age": 30})

print(response)  # Response generated by the LLM

If you have a prompt folder with multiple prompt files, you can change the active prompt with the change_prompt method and know the name of the available prompt files with get_available_prompts method:

from openrouter_manager import AiAgent

# Get the singleton instance of the agent
agent = AiAgent()

# Get available prompts in the folder
available_prompts = agent.get_available_prompts()
print(available_prompts)  # List of available prompt files ["example.prompt", "another_example.prompt"]

# Change the active prompt to a specific file
agent.change_prompt("example.prompt")

# Resolve the prompt with dynamic variables
response = agent.resolve({"name": "Alice", "age": 25})

print(response)  # Response generated by the LLM

Contributing

If you would like to contribute to this project, you can clone the repository and make modifications:

git clone https://github.com/your_username/openrouter-manager.git
cd openrouter-manager

Contributions are welcome. Make sure to follow best coding practices and document your changes.

License

This project is open-source, owned by Koral Advanced Technology, and developed by Lenin David Lozano. It is freely available for use and modification under the MIT License. See the LICENSE file for more details. .. pyscaffold-notes:

Note

This project has been set up using PyScaffold 4.6. For details and usage information on PyScaffold see https://pyscaffold.org/.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openrouter_manager-0.0.3.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openrouter_manager-0.0.3-py2.py3-none-any.whl (7.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file openrouter_manager-0.0.3.tar.gz.

File metadata

  • Download URL: openrouter_manager-0.0.3.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for openrouter_manager-0.0.3.tar.gz
Algorithm Hash digest
SHA256 530f711b628e467cc8c5ac27ccd0a959efc5e1d9b3936824a57b05fd8e5997be
MD5 6ad45615e4c1974f59206059782b7eaf
BLAKE2b-256 b095e87127ca9a2d4aa2239ff64b8db9eeba48bc7e55ad09be699e1c338ce7aa

See more details on using hashes here.

File details

Details for the file openrouter_manager-0.0.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for openrouter_manager-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 02900384897c54b29df33bdde0d533dccaca5ab4e1cebb5e94bcd600f9b0e1a9
MD5 3c145be7e4d42cc29f96e1c12632c894
BLAKE2b-256 5a0faf5a0afaf2fb57c8798ec41abd33cd49bc9843658f17e8f2021ed60981f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page