fetch('https://openrouter.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: 'Bearer OPENROUTER_API_KEY',
'HTTP-Referer': 'YOUR_SITE_URL',
'X-Title': 'YOUR_SITE_NAME',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'openai/gpt-4o',
messages: [
{
role: 'user',
content: 'What is the meaning of life?',
},
],
}),
});
from openrouter import OpenRouter
import os
with OpenRouter(api_key=os.getenv("OPENROUTER_API_KEY")) as client:
response = client.chat.send(
model="~openai/gpt-sol-latest",
messages=[
{"role": "user", "content": "What is the meaning of life?"}
],
)
print(response.choices[0].message.content)
4健康主播鄭凱云 https://www.youtube.com/@health_2.0: RT @_waleedshahid: Ta-Nehisi Coates: "Biden shouldn’t be president...Biden says that he’s been involved with civil rights his entire career. It’s worth remembering Joe Biden opposed busing and bragged about it." "When somebody shows you who they are, believe them. This is who Joe Biden is." https://t.co/y41a5zK1pv
fetch('https://openrouter.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
Authorization: 'Bearer OPENROUTER_API_KEY',
'HTTP-Referer': 'YOUR_SITE_URL',
'X-Title': 'YOUR_SITE_NAME',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'openai/gpt-4o',
messages: [
{
role: 'user',
content: 'What is the meaning of life?',
},
],
}),
});
RT @_waleedshahid: Ta-Nehisi Coates: "Biden shouldn’t be president...Biden says that he’s been involved with civil rights his entire career. It’s worth remembering Joe Biden opposed busing and bragged about it." "When somebody shows you who they are, believe them. This is who Joe Biden is." https://t.co/y41a5zK1pv
沒有留言:
張貼留言