PHP with DEVUP AI
Call DEVUP AI models from any PHP project. openai-php/client works with DEVUP AI as soon as its base URI points at the DEVUP AI API.
System Architecture
How PHP Connects to DEVUP AI
Configuration
Connect the Client
composer require openai-php/client guzzlehttp/guzzlerequire __DIR__ . '/vendor/autoload.php';
$client = OpenAI::factory()
->withApiKey(getenv('DEVUP_API_KEY'))
->withBaseUri('https://api.devupai.com/v1')
->make();
$response = $client->chat()->create([
'model' => 'deepseek-ai/DeepSeek-V4-Pro',
'messages' => [
['role' => 'user', 'content' => 'Reply with exactly: Salam DEVUP'],
],
]);
echo $response->choices[0]->message->content, PHP_EOL;Tools
Tool Calling in PHP
$tools = [[
'type' => 'function',
'function' => [
'name' => 'get_order_status',
'description' => 'Look up the delivery status of an order by its ID.',
'parameters' => [
'type' => 'object',
'properties' => ['order_id' => ['type' => 'string']],
'required' => ['order_id'],
],
],
]];
$messages = [['role' => 'user', 'content' => 'What is the status of order A-100?']];
$first = $client->chat()->create([
'model' => 'deepseek-ai/DeepSeek-V4-Pro',
'messages' => $messages,
'tools' => $tools,
]);
$call = $first->choices[0]->message->toolCalls[0];
$args = json_decode($call->function->arguments, true);
$status = 'Order ' . $args['order_id'] . ' has shipped. Tracking number: DZ-4471.';
$messages[] = $first->choices[0]->message->toArray();
$messages[] = ['role' => 'tool', 'tool_call_id' => $call->id, 'content' => $status];
$final = $client->chat()->create([
'model' => 'deepseek-ai/DeepSeek-V4-Pro',
'messages' => $messages,
'tools' => $tools,
]);
echo $call->function->name, ': ', $final->choices[0]->message->content, PHP_EOL;Capabilities
Supported Capabilities
Chat and streaming
create returns the full reply; createStreamed yields chunks as they are generated.
Tool calling
Describe tools as JSON schema, run the one the model picks, and send its result back with toArray().
JSON output and embeddings
Request a JSON-schema response format, or create embeddings with a catalog embedding model.
Local DZD billing
Metered billing in Algerian Dinar with BaridiMob, Edahabia, and CIB local payment support.
FAQ
PHP and DEVUP AI
Can I use openai-php/client with DEVUP AI?
Yes. Build the client with withBaseUri('https://api.devupai.com/v1') and your DEVUP AI key; chat, streaming, tools, JSON-schema output and embeddings then go to DEVUP AI.
Which PHP version do I need?
openai-php/client requires PHP 8.2 or newer, with the openssl and curl extensions enabled.
How is PHP usage billed on DEVUP AI?
Every request is a regular DEVUP AI API call, metered in Algerian Dinar on your account.