Download the PHP package webman/openai without Composer

On this page you can find all versions of the php package webman/openai. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package openai

webman/openai

English | 简体中文

Non-blocking OpenAI client for PHP with coroutine support and a built-in connection pool, designed for Workerman / webman.

Installation

Requires PHP 8.1+ and a Workerman 5.1+ runtime.

Enable coroutines in webman
Set webman.eventLoop in config/process.php to Workerman\Events\Fiber::class.
If the swoole or swow extension is installed, you may use Workerman\Events\Swoole::class or Workerman\Events\Swow::class instead.


Quick overview (Workerman)

Non-streaming

Streaming


Chat: completions (Webman)

Note
API usage is the same whether you run under Workerman or webman; the examples below use webman.

Coroutines · non-streaming

Coroutines · streaming

Under coroutines, streaming returns a generator: send response headers to the client first, then emit each piece with Chunk, and finish with close.

Async callbacks · streaming

Async callbacks · non-streaming

Tool / function calling (tools)


Image: generations (Webman)

Coroutines

Async callbacks


Embedding: vectors (Webman)

Coroutines

Async callbacks


Audio: text-to-speech (TTS) (Webman)

Coroutines

Coroutines · streaming

Async callbacks · streaming


Audio: speech-to-text (STT / transcriptions) (Webman)

Coroutines · non-streaming

Coroutines · streaming (SSE events)

Async callbacks · non-streaming

Async callbacks · streaming


Gateway compatibility: Azure OpenAI

Coroutines · Chat streaming

Async callbacks · Chat streaming


Gateway compatibility: Alibaba Cloud DashScope (OpenAI-compatible mode)

Documentation: https://help.aliyun.com/zh/dashscope/developer-reference/compatibility-of-openai-with-dashscope

Coroutines · Chat streaming

When Chat is configured with an api URL that includes a path, if the path ends with a trailing slash (/), chat/completions is appended automatically (same pattern as the OpenAI-compatible path). For DashScope compatibility mode, use a base URL ending with /v1/:

Async callbacks · Chat streaming


Optional parameters

The second argument $options on each API method may include:


Response headers: with_response

Non-streaming

Note
Other endpoints also support with_response to obtain the Response object; usage is the same.

Streaming


Exceptions and errors

Error handling is unified across coroutine and async styles via the same Webman\Openai\OpenAIException class.


Coroutines · non-streaming

Coroutines · streaming

Async callbacks · non-streaming


All versions of openai with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
workerman/workerman Version ^5.1
workerman/http-client Version ^3.1
revolt/event-loop Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webman/openai contains the following files

Loading the files please wait ...