Use openrouter
This commit is contained in:
@@ -32,22 +32,25 @@ export default defineEventHandler(async (event) => {
|
||||
user: user!,
|
||||
}).catch((err) => [err]);
|
||||
if (aiError) {
|
||||
console.log(aiError.message);
|
||||
throw createError({
|
||||
statusCode: 500,
|
||||
message: `OPENAI API: ${aiError.message}`,
|
||||
});
|
||||
}
|
||||
|
||||
await strava!(`activities/${body.object_id}`, {
|
||||
method: "PUT",
|
||||
body: {
|
||||
name: stravaRequestBody.name,
|
||||
description: stravaRequestBody.description,
|
||||
},
|
||||
}).catch((error) => {
|
||||
throw createError({
|
||||
statusCode: 500,
|
||||
message: `Strava API: ${error.message}`,
|
||||
});
|
||||
});
|
||||
console.log(JSON.stringify(stravaRequestBody));
|
||||
|
||||
// await strava!(`activities/${body.object_id}`, {
|
||||
// method: "PUT",
|
||||
// body: {
|
||||
// name: stravaRequestBody.name,
|
||||
// description: stravaRequestBody.description,
|
||||
// },
|
||||
// }).catch((error) => {
|
||||
// throw createError({
|
||||
// statusCode: 500,
|
||||
// message: `Strava API: ${error.message}`,
|
||||
// });
|
||||
// });
|
||||
});
|
||||
|
||||
@@ -137,7 +137,7 @@ export const createActivityContent = async ({
|
||||
`;
|
||||
|
||||
const aiResponse = await openai.responses.create({
|
||||
model: "gpt-5",
|
||||
model: "@preset/ghostwriter",
|
||||
input: [{ role: "user", content: prompt }],
|
||||
reasoning: {
|
||||
effort: "minimal",
|
||||
|
||||
@@ -4,7 +4,8 @@ export const useOpenAI = () => {
|
||||
const config = useRuntimeConfig();
|
||||
|
||||
const client = new OpenAI({
|
||||
apiKey: config.openaiApiKey,
|
||||
apiKey: config.openrouterApiKey,
|
||||
baseURL: "https://openrouter.ai/api/v1",
|
||||
});
|
||||
|
||||
return client;
|
||||
|
||||
Reference in New Issue
Block a user