Download the PHP package cable8mm/nano-ai without Composer

On this page you can find all versions of the php package cable8mm/nano-ai. 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 nano-ai

NanoAI

code-style run-tests PHP Version Packagist Version Packagist Downloads Packagist License

Ultra-lightweight, zero-config PHP AI SDK. No agents/RAG — just generate() for text + image (multimodal) calls. Use it for testing, lightweight pipelines, and idea validation.

Supported Providers

Provider Description
openai Direct connection to OpenAI Chat Completions
openrouter Call most models (OpenAI/Gemini/DeepSeek/Qwen, etc.) via a single API by just changing the model name. Free models use :free suffix

Installation

Usage

Configuration Options

The Client constructor accepts an optional $options array to customize behavior:

Available Options

Option Type Default Description
timeout int 120 Maximum time to wait for API response (seconds)
connectTimeout int 30 Maximum time to establish connection (seconds)
baseUrl string Provider default Override the API base URL
referer string None Custom Referer header sent with requests
title string None Custom X-Title header sent with requests

Note: Options like baseUrl, referer, and title are particularly useful when using OpenRouter or custom OpenAI-compatible APIs.

To test with free/low-cost models:

Exceptions

All extend NanoAIException, so you can catch them all at once.

Using Guzzle as the HTTP Client (Optional)

By default, nano-ai uses a minimal cURL-based HTTP client with zero external dependencies. If you prefer Guzzle (or need its advanced features like middleware, retries, proxies, etc.), install it and inject the provided GuzzleHttpClient:

The GuzzleHttpClient implements the same HttpClientInterface as the default cURL client, so it is a drop-in replacement. All nano-ai features (timeouts, error handling, etc.) work identically.

Adding a New Provider

Create a class implementing NanoAI\Provider\ProviderInterface (if it's an OpenAI-compatible API, you can extend AbstractOpenAICompatibleProvider), then add one line to ProviderFactory::make().

No need to modify Client or HttpClient.

Development

End-to-End Testing (Real API)

The default test suite uses mock servers and fake HTTP clients — no external network access required.

To verify against the real OpenAI/OpenRouter APIs:

These tests are opt-in and skipped by default. They make real API calls and may incur costs. The tests/config.json file is gitignored and will never be committed.

License

MIT


All versions of nano-ai with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
ext-curl Version *
ext-json Version *
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 cable8mm/nano-ai contains the following files

Loading the files please wait ...