📄 Source: test_api.php
<?php
$openRouterKey = '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';
// List of verified free models on OpenRouter
$models = [
'openrouter/auto',
'nousresearch/hermes-3-llama-3.1-405b:free',
'microsoft/phi-3.5-mini-128k-instruct:free',
'qwen/qwen-2.5-7b-instruct:free',
];
foreach ($models as $model) {
$url = 'https://openrouter.ai/api/v1/chat/completions';
$data = [
'model' => $model,
'messages' => [['role' => 'user', 'content' => 'Say OK']]
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Authorization: Bearer ' . $openRouterKey
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
echo "$model: HTTP $httpCode\n";
if ($httpCode == 200) {
echo "✓ WORKING!\n\n";
} else {
echo "✗ Failed\n\n";
}
}
?>
← Back