Add OpenRouter headers to image generation requests
| @@ -2,6 +2,7 @@ import express from 'express'; | ||
| 2 | 2 | import fetch from 'node-fetch'; |
| 3 | 3 | import mime from 'mime-types'; |
| 4 | 4 | import { readSecret, SECRET_KEYS } from './secrets.js'; |
| 5 | +import { OPENROUTER_HEADERS } from '../constants.js'; | |
| 5 | 6 | |
| 6 | 7 | export const router = express.Router(); |
| 7 | 8 | const API_OPENROUTER = 'https://openrouter.ai/api/v1'; |
| @@ -119,6 +120,7 @@ router.post('/image/generate', async (req, res) => { | ||
| 119 | 120 | const response = await fetch(`${API_OPENROUTER}/chat/completions`, { |
| 120 | 121 | method: 'POST', |
| 121 | 122 | headers: { |
| 123 | + ...OPENROUTER_HEADERS, | |
| 122 | 124 | 'Content-Type': 'application/json', |
| 123 | 125 | 'Authorization': `Bearer ${key}`, |
| 124 | 126 | }, |