Last active
April 13, 2026 05:59
-
-
Save dubiao/7cfcf2bb4c47ba9bff3d4fee6768db53 to your computer and use it in GitHub Desktop.
List all free models on openrouter.ai
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const https = require('https'); | |
| const options = { | |
| hostname: 'openrouter.ai', | |
| path: '/api/frontend/models/find?max_price=0&order=pricing-low-to-high&fmt=cards&output_modalities=text', | |
| method: 'GET', | |
| headers: { | |
| 'accept': '*/*', | |
| 'accept-language': 'zh-CN,zh-HK;q=0.9,zh-TW;q=0.8,zh;q=0.7,en;q=0.6', | |
| 'cache-control': 'no-cache', | |
| 'pragma': 'no-cache', | |
| 'referer': 'https://openrouter.ai/models?max_price=0&order=pricing-low-to-high&fmt=cards&output_modalities=text', | |
| 'sec-ch-ua': '"Chromium";v="148", "Microsoft Edge";v="148", "Not/A)Brand";v="99"', | |
| 'sec-ch-ua-mobile': '?0', | |
| 'sec-ch-ua-platform': '"macOS"', | |
| 'sec-fetch-dest': 'empty', | |
| 'sec-fetch-mode': 'cors', | |
| 'sec-fetch-site': 'same-origin', | |
| 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36 Edg/148.0.0.0' | |
| } | |
| }; | |
| const req = https.request(options, (res) => { | |
| let data = ''; | |
| res.on('data', (chunk) => { | |
| data += chunk; | |
| }); | |
| res.on('end', () => { | |
| try { | |
| const response = JSON.parse(data); | |
| const models = response.data.models || []; | |
| if (process.argv.includes('--verbose')) { | |
| console.log(JSON.stringify(response, null, 2)); | |
| } | |
| const result = models | |
| .map(model => ({ | |
| model_name: model.name, | |
| model_slug: model.slug, | |
| description: model.description, | |
| free_slug: model.endpoint?.model_variant_slug, | |
| context_length: model.context_length, | |
| reasoning: model.supports_reasoning, | |
| is_free: model.endpoint?.is_free, | |
| _modalities: { | |
| input: model.input_modalities, | |
| output: model.output_modalities, | |
| has_text_output: model.has_text_output | |
| }, | |
| supported_parameters: model.endpoint?.supported_parameters, | |
| })) | |
| .filter(v => v.is_free && v._modalities.has_text_output); | |
| if (process.argv.includes('--json')) { | |
| console.log(JSON.stringify(result, null, 2)); | |
| } else { | |
| const tableData = result.map(m => ({ | |
| name: m.model_name, | |
| free_slug: m.free_slug, | |
| context_length: m.context_length, | |
| reasoning: m.reasoning | |
| })); | |
| console.table(tableData); | |
| } | |
| } catch (e) { | |
| console.error('Error:', e.message); | |
| } | |
| }); | |
| }); | |
| req.on('error', (e) => { | |
| console.error(`Request Error: ${e.message}`); | |
| }); | |
| req.end(); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
But you will know, free models are slow and have always reached their rate limits.