{model.streamCancel
? 'You can safely abort streaming requests to control costs. The model will stop processing immediately.'
: 'This provider does not support stream cancellation. You will be charged for the complete response even if you abort the request.'
}
{model.reasoning && (
{renderExample(
{
method: 'POST',
url: 'https://openrouter.ai/api/v1/chat/completions',
headers: baseExample.headers,
body: {
model: model.id,
messages: [
{ role: 'user', content: 'Solve this math problem step by step: What is 15% of 240?' }
],
stream: true,
reasoning: {
effort: 'high'
}
}
},
'Streaming + Reasoning',
'Combines streaming with reasoning tokens for real-time thinking process visibility.'
)}
This demo shows the improved model picker with live data fetching,
proper model filtering, and exact model ID usage. The API key is only used for testing actual model calls.
{/* Current Selection */}
Current Selection
{selectedModel ? (() => {
// Use the selected model info from the enhanced callback
const model = selectedModelInfo || models.find(m => m.id === selectedModel)
return (
âšī¸ This model supports reasoning tokens for step-by-step thinking
)}
{model.streamCancel && (
âšī¸ This model supports stream cancellation for cost control
)}
)}
â This exact model ID will be used in API calls (no suffixes added)
)
})() : (
No model selected
)}
{selectedModel && (
<>
>
)}
{/* API Key Input - Only shown when needed */}
{showApiKeyInput && (
API Key Required
setApiKey(e.target.value)}
placeholder="Enter your OpenRouter API key..."
onKeyDown={(e) => e.key === 'Enter' && handleApiKeySubmit()}
style={{
width: '100%',
padding: '0.5rem',
border: '1px solid #d1d5db',
borderRadius: '0.375rem',
fontSize: '0.875rem'
}}
autoFocus
/>
đĄ Your API key is needed to make actual test calls to the OpenRouter API
)}
{/* Test Results */}
{testResult && (
Test Result
{testResult.success ? (
Response: {testResult.response}
{testResult.usage && (
Usage: {testResult.usage.prompt_tokens} prompt + {testResult.usage.completion_tokens} completion = {testResult.usage.total_tokens} total tokens
)}
) : (
Error: {testResult.error}
)}
)}
{/* Features Section */}
Key Features
â Live model fetching from OpenRouter API (no API key needed)
â đ§ Reasoning model detection - Automatically detects and highlights o1, DeepSeek R1, and other thinking models
â Enhanced deprecated model filtering - Removes models that cause 404 errors
â Free vs paid model categorization
â Exact model ID usage (no ":free" suffixes)
â Real model testing with API key (actual completions)
â Improved error handling and fallback models
â Enhanced UI with model statistics
đĄ Tip: Check the browser console to see filtering stats -
broken models are pre-filtered out, experimental models can be hidden via checkbox.