DelphiOpenAI  by HemulGM

Delphi SDK for OpenAI APIs (plus DeepSeek, Azure OpenAI, YandexGPT)

created 2 years ago
275 stars

Top 94.9% on sourcepulse

GitHubView on GitHub
Project Summary

This repository provides an unofficial Delphi wrapper for the OpenAI API, enabling developers to integrate services like ChatGPT, DALL-E, and Whisper into their Delphi applications. It supports a wide range of OpenAI functionalities, including text generation, image creation, audio processing, and function calling, with ongoing development for Assistants API features.

How It Works

The library offers a direct implementation of OpenAI's RESTful API endpoints using Delphi's native HTTP client components. It abstracts the complexities of JSON serialization/deserialization and request/response handling, providing a Pascal-native interface for interacting with models like GPT-3.5-turbo and GPT-4. The design emphasizes ease of use with anonymous methods for parameter configuration and includes robust error handling for API-specific exceptions.

Quick Start & Requirements

  • Installation: Add the root folder to your Delphi IDE's library path or project source path.
  • Requirements: Delphi 10.3 or newer. No third-party libraries are required.
  • Compatibility: Tested on Windows, with expected compatibility for Linux, macOS, Android, and iOS.
  • Note: Exposing API keys in client applications is not recommended due to security risks.

Highlighted Details

  • Comprehensive coverage of OpenAI API features, including Chat Vision and Function Calling.
  • Support for multiple AI providers: OpenAI, DeepSeek, Azure OpenAI, and YandexGPT.
  • Includes streaming responses for chat completions.
  • Provides specific exception classes for API errors.

Maintenance & Community

The project is maintained by HemulGM. Further community engagement details (e.g., Discord/Slack) are not specified in the README.

Licensing & Compatibility

  • License: MIT License.
  • Compatibility: Permissive license allows for commercial use and integration into closed-source applications.

Limitations & Caveats

The Assistants, Threads, and Messages APIs are marked as "In progress." The library is unofficial, meaning it is not supported or endorsed by OpenAI. Exposing API keys in client applications poses a security risk.

Feedback? Help us improve.