TCM i Kultura Prosta Spółka Akcyjna

libAIConnect

A library for utilizing the API of OpenAI, Claude AI, Google Gemini or Mistral AI.

The library is designed for the management and utilization of API keys, AI models and preset roles. The executable program is not only a demo for showing how to use the library, but also a handy tool that runs on a terminal.

The library is released under GNU Lesser General Public License version 3.0, while the executable program is released under Apache License version 2.0.


Version 1.0.5 - Release Notes

Download source: libAIConnect-1.0.5.tar.xz

Download binary for Linux (amd64): libAIConnect-1.0.5-linux-amd64.tar.xz (Built using GCC 14.2, cmake and make; tested on Debian 13 for amd64)

Download binary for Linux (arm64): libAIConnect-1.0.5-linux-arm64.tar.xz (Built using GCC 15.2, cmake and make; tested on 64-bit Raspberry Pi OS on Raspberry Pi 5)

Download binary for Windows 11 (amd64): libAIConnect-1.0.5-win11-amd64.tar.xz (Built using MSYS2 MinGW-w64 GCC 15.2, cmake and ninja; tested on Windows 11 25H2)


Third-Party Libraries

The program dynamically uses the library libcurl. If you use a Linux distribution, please install the package libcurl before using libAIConnect. The binary for Windows is distributed with libcurl library. The library libcurl is distributed under curl License (Copyright (c) 1996 - 2025, Daniel Stenberg, daniel@haxx.se. All rights reserved.).

The binary for Windows is distributed with GCC runtime libraries and MinGW-w64 winpthreads library. GCC runtime libraries are distributed under GCC Runtime Library Exception. MinGW-w64 winpthreads library is distributed under MIT License and BSD 3-Clause Clear License (Copyright (c) 2011 mingw-w64 project. (C) 2010 Lockless Inc. All rights reserved.).


How to Use the Executable Program

aiConnect [options]

The config file of the program is saved in ~/.config/aiConnect/aiConnect.conf

Options:

Part I: Add/Update Keys, Models or Roles

--add-key

Add or update an API key.

The AI provider's name and the API key are required, which are separated by a colon.

Different provider names with keys are separated by a comma.

Supported AI provider names: OpenAI, Gemini, Claude, Mistral.

For example:

--add-key OpenAI:key1, Gemini:key2

Note:

If you just simply input --add-key without giving any information,

the program will ask about the information step by step.

If the AI provider's API key has been saved before, the command will update it.

--add-model

Add or update an AI model.

The AI provider's name, the custom name of the model, and the identifier name of the model are required, which are separated by a colon.

Different models are separated by a comma.

The identifier name of a model is used for API connections, but the custom name of the model can be set by yourself.

When inputting a custom name with a space, please enclose the name in double quotation marks.

For example:

--add-model Claude:"Claude Sonnet 4":claude-sonnet-4-20250514, Mistral:"Codestral 2508":codestral-2508

Note:

If you just simply input --add-model without giving any information, the program will ask about the information step by step.

If the custom name with the AI provider has been saved before, the command will update the identifier name.

--add-role

Add or update a preset role with instructions.

The role's name, the role instruction, and detailed instructions are required, which are separated by a colon.

If the role's name, the role instruction or detailed instructions contains a space, it should be enclosed in double quotation marks, or you may enclose the entire string for a preset role in double quotation marks.

During an API connection, role instruction is generally combined with detailed instructions as a part of the value of content. Buf if an API supports a separate definition for a role, the role instruction may be sent separately.

For example:

--add-role translator:"You are a translator.":"Requirements: 1. Please give the entire text of your translation firstly, which is enclosed in <translation></translation>, and then give your comment, which is enclosed in <comment></comment>; 2. The translation follows native expressions of the target language; 3. For confusing meanings, please provide detailed explanation in your comment."

--add-role "translator:You are a translator.:Requirements: 1. Please give the entire text of your translation firstly, which is enclosed in <translation></translation>, and then give your comment, which is enclosed in <comment></comment>; 2. The translation follows native expressions of the target language; 3. For confusing meanings, please provide detailed explanation in your comment."

Note:

If you just simply input --add-role without giving any information, the program will ask about the information step by step.

If the role name has been saved before, the command will update the role instruction and detailed instructions.

Part II: Show Keys, Models or Roles

--show-keys

Show all saved API keys.

--show-models

Show all saved AI models.

--show-roles

Show the names of all preset roles.

--show-role

Show the details of a preset role.

Please give the role's name.

For showing the details of multiple roles, please separate their names by a comma.

For example:

--show-role translator, teacher

Note:

If you just simply input --show-role without giving any information, the program will ask about the information step by step.

Part III: Remove Keys, Models or Roles

--remove-key

Remove an API key.

Please give the AI provider's name that you inputted for adding the key.

Supported AI provider names: OpenAI, Gemini, Claude, Mistral.

For removing multiple keys, please separate the names of AI providers by a comma.

For example:

--remove-key OpenAI, Gemini

Note:

If you just simply input --remove-key without giving any information, the program will ask about the information step by step.

--remove-model

Remove an AI model.

Please give the AI provider's name and the custom name of the model, which are separated by a colon.

If the custom name of a model contains a space, please enclose the name in double quotation marks.

For removing multiple models, please separate different models by a comma.

For example:

--remove-model Claude:"Claude Sonnet 4", Mistral:"Codestral 2508"

Note:

If you just simply input --remove-model without giving any information, the program will ask about the information step by step.

--remove-role

Remove a preset role.

Please give the role's name.

For removing multiple roles, please separate their names by a comma.

For example:

--remove-role translator, teacher

Note:

If you just simply input --remove-role without giving any information, the program will ask about the information step by step.

Part IV: Use AI

-model

Specify an AI model.

Please input the custom name of the model.

If the name includes a space, it should be enclosed in double quotation marks.

For example:

-model "Claude Sonnet 4"

Note:

If you just simply input -model without giving any information, the program will ask about the information step by step.

If models from different providers have the same custom name, one of the models will be randomly used.

-role

Specify a preset role for AI, or give a role instruction to AI.

For choosing a role that is created by the --add-role option, please input the role's name.

A role instruction to AI should be enclosed in double quotation marks.

For example:

-role translator

-role "You are a translator."

Note:

If you just simply input -role without giving any information, the program will ask about the information step by step.

-content

Give specific instructions to AI.

If you have set a preset role, please do not repeat the detailed instructions for the role, because the detailed instructions for the preset role will be sent together with the specific instructions as the value of content during an API connection.

Please enclose the instructions in double quotation marks.

For example:

-content "Please translate the contents enclosed in <text></text> into Chinese: <text>Do not treat others the way you do not want to be treated.</text>"

Note:

If you just simply input -content without giving any information, the program will ask about the information step by step.

If no information is given, the program will not perform an API connection.

TCM i Kultura Prosta Spółka Akcyjna

Article category:

TCM i Kultura Prosta Spółka Akcyjna © All rights reserved.