Files
OmniRoute/examples/quickstart/php_curl.php
Diego Rodrigues de Sa e Souza 84504e3f1f chore(providers): retire Felo Web on provenance hold (#11698)
Merged via /merge-batch (v3.8.51 provenance sweep). Boarded and validated together with the batch's other retirement PRs in a combined worktree — full gate suite green. This PR's conflicts (against #11720's Designer retirement, both introducing a retirement-guard mechanism across executors/index.ts, executorProxy.ts, providers.ts, reservedProviderPrefixes.ts, auth.ts, chat.ts, chatHelpers.ts, model.ts) were reconciled by combining both guards at every chokepoint, with the shared reserved-prefix count recomputed (not guessed) at 400. Re-validated with this PR's own 72 node:test + 20 vitest focused tests, all passing, and pushed before merge. Thank you.
2026-08-28 05:03:51 -03:00

43 lines
1.1 KiB
PHP

<?php
/**
* OmniRoute Quickstart — PHP (cURL)
* ===================================
* Run: php php_curl.php
* Requires: PHP 7.4+ with cURL extension enabled
*/
// Your local OmniRoute server — started with: npx omniroute
$api_url = "http://localhost:20128/v1/chat/completions";
$headers = [
"Content-Type: application/json",
"Authorization: Bearer dummy-key", // Any string works for free/keyless providers
];
$data = [
"model" => "auto", // Zero-config routing, works out of the box — no sign-up needed
"stream" => false,
"messages" => [
["role" => "user", "content" => "Hello! What can you do?"],
],
];
$ch = curl_init($api_url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => $headers,
]);
$response = curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($http_code === 200) {
$result = json_decode($response, true);
echo $result['choices'][0]['message']['content'] . PHP_EOL;
} else {
echo "Error HTTP $http_code: $response" . PHP_EOL;
}