Skip to content

Instantly share code, notes, and snippets.

@iamavnish
Last active July 13, 2025 02:07
Show Gist options
  • Save iamavnish/31140408c68dfdf17dd2f9fb82de900b to your computer and use it in GitHub Desktop.
Save iamavnish/31140408c68dfdf17dd2f9fb82de900b to your computer and use it in GitHub Desktop.
Access LLMs through OpenRouter (Provider)
from openai import OpenAI
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key="<YOUR OPEN ROUTER API KEY>",
)
completion = client.chat.completions.create(
model="tngtech/deepseek-r1t2-chimera:free",
messages=[
{
"role": "user",
"content": "What is the meaning of life?"
}
]
)
print(completion.choices[0].message.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment