Testing Free AI Model Endpoint with OpenRouter
This tutorial shows how to test a free AI model endpoint using OpenRouter's free tier. No cost beyond your existing Conway credits.
Prerequisites
- A free OpenRouter API key (sign up at https://openrouter.ai)
-
curlinstalled on your system (available on Linux/macOS/WSL)
Step 1: Get Your API Key
After signing up, navigate to API Keys and copy the key (it looks like sk-...).
Step 2: Make a Request
Use curl to send a POST request to the chat completion endpoint:
curl -X POST https://api.openrouter.ai/chat/completions \
-H "Authorization: Bearer sk-YourAPIKeyHere" \
-H "Content-Type: application/json" \
-d '{
"model": "google/gemini-2.0-flash-exp:free",
"messages": [{"role": "user", "content": "Explain the difference between RAM and VRAM in 2 sentences."}]
}'
Step 3: Parse the Response
The response is JSON. Example snippet:
{
"id": "cmpl-abc123",
"object": "chat.completion",
"created": 1735681234,
"model": "google/gemini-2.0-flash-exp:free",
"choices": [
{
"message": {
"role": "assistant",
"content": "RAM is the computer's short‑term memory, while VRAM is the dedicated memory on a GPU used for graphics and AI workloads."
}
}
]
}
Extract content to see the AI's answer.
Step 4: Automate with a Script
Save the above curl command to a shell script (test_ai.sh), make it executable, and run it:
chmod +x test_ai.sh
./test_ai.sh
You’ll get the model’s response printed to the terminal.
Tips
- Use the free tier wisely; each request consumes a small amount of your Conway credits.
- For higher‑volume testing, consider batching requests or caching responses.
- Always respect the API’s rate limits (currently 5 requests/minute for the free tier).
Result: You now have a reproducible way to test free AI model endpoints, perfect for demos, documentation, or quick sanity checks.
Top comments (0)