OpenAI API Client

For your PHP and JavaScript applications, that uses fully typed requests and responses.

Add Artificial Intelligence to your PHP or JavaScript applications in minutes.

Supports popular OpenAI models including GPT-3, Codex and DALL·E.

Easily connect up to the popular Completions, Images and Moderations endpoints using smart data objects that have full knowledge of the data type and structures so you can quickly and easily implement your user application.

Integrating OpenAI into your JavaScript application is now as simple as:

const tectalicOpenai = require('@tectalic/openai').default;
 
const openaiClient = tectalicOpenai(process.env.OPENAI_API_KEY);
 
const response = openaiClient.completions.create({
model: 'text-davinci-003',
prompt: 'Will using a third party package save time?'
})
 
response.then((result) => {
console.log(result.data.choices[0].text)
});
// Using a third party package can save time because you don't have to write the code yourself.

Integrating OpenAI into your PHP application is now as simple as:

$openaiClient = \Tectalic\OpenAi\Manager::build(
new \GuzzleHttp\Client(),
new \Tectalic\OpenAi\Authentication(getenv('OPENAI_API_KEY'))
);
 
/* @var \Tectalic\OpenAi\Models\Completions\CreateResponse $response */
$response = $openaiClient->completions()->create(
new \Tectalic\OpenAi\Models\Completions\CreateRequest([
'model' => 'text-davinci-003',
'prompt' => 'Will using a third party package save time?',
])
)->toModel();
 
echo $response->choices[0]->text;
// Using a third party package can save time because you don't have to write the code yourself.

You can even train your own unique AI model using Fine Tunes to ensure your app stands out from the crowd.

OpenAI Logo

OpenAI API Client Features

Fully Typed Smart Data Objects

All requests and responses are fully typed, with complete details of the OpenAI API request and response structures at your fingertips.

IDE Autocompletion

All API endpoints, requests and responses are fully documented within advanced IDEs such as Visual Studio Code or PhpStorm.

Faster API Integration Projects

Spend your time building great software, not reading complex API documentation.

All 20 Endpoints Supported

Make full use of the OpenAI API, with the ability to easily query all 20 API endpoints.

Fully Tested

By our developers, with unit and functional integration tests. All test cases are provided.

Fully Supported

Our Australian-based team of developers are here to help you.

OpenAI JavaScript API Client

Written in JavaScript

With everything you need

  • A convenient interface for interacting with the OpenAI API.
  • Type definitions for all requests and responses.
  • Supports Node.js, JavaScript or Typescript applications.
  • Simple installation via npm.

Get started today


OpenAI PHP API Client

Written in PHP

With everything you need

  • A convenient fluent interface for interacting with the OpenAI API.
  • Data Transfer Objects (DTOs) for all requests and responses.
  • Compatible with PHP versions 7.2.5 → 8.1.

From the Blog

Announcement

An OpenAI API Client (SDK) for Your JavaScript Projects

Our new OpenAI REST API Client is now available, with GPT-3, Codex and DALL·E model support. Includes Typescript declarations for all requests and responses and IDE autocomplete support.

Read more
Tutorial

How to build a PHP app using the OpenAI API

Learn how to build an AI-based business name generator application using PHP, Laravel and the OpenAI API.

Read more
Announcement

An OpenAI API Client (SDK) for Your PHP Projects

Our new OpenAI REST API Client is now available, with GPT-3 and Codex model support. Includes Data Transfer Objects (DTOs) for all requests and responses and IDE autocomplete support.

Read more