Advertisement
The simplest way to get free inference. openrouter/free is a router that selects free models at random from the models available on OpenRouter. The router smartly filters for models that...
from openai import OpenAI
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key="YOUR_API_KEY"
)
response = client.chat.completions.create(
model="openrouter/free",
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)