Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(openrouter): send consistent app attribution headers on every OpenRouter call

nirholas8b5cfb5d8c8f
diff --git a/api/_lib/anatomy/writer.js b/api/_lib/anatomy/writer.js
index feb6ff63f..2c402b76f 100644
--- a/api/_lib/anatomy/writer.js
+++ b/api/_lib/anatomy/writer.js
@@ -17,6 +17,7 @@
// machine before the next rung starts over.
import { llmComplete } from '../llm.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from '../openrouter-attribution.js';
import { recordEvent } from '../usage.js';
export const ANATOMY_MODEL_DEFAULT = 'claude-opus-5';
@@ -186,7 +187,7 @@ export function writerRungs(env = process.env) {
for (const model of [...new Set([primary, FALLBACK_CLAUDE])]) {
rungs.push(
chat('openrouter', 'https://openrouter.ai/api/v1/chat/completions', env.OPENROUTER_API_KEY, `anthropic/${model}`, {
- headers: { 'http-referer': 'https://three.ws', 'x-title': 'three.ws Anatomy' },
+ headers: OPENROUTER_ATTRIBUTION_HEADERS,
}),
);
}
diff --git a/api/_lib/llm-health.js b/api/_lib/llm-health.js
index 32a347103..152366e0d 100644
--- a/api/_lib/llm-health.js
+++ b/api/_lib/llm-health.js
@@ -38,6 +38,7 @@
import { env } from './env.js';
import { vertexClaudeEnabled, vertexMessagesUrl, vertexRequestHeaders, toVertexBody } from './vertex-claude.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from './openrouter-attribution.js';
const PROBE_TIMEOUT_MS = 5_000;
@@ -150,7 +151,7 @@ export async function probeLlmHealth() {
key: env.OPENROUTER_API_KEY,
url: 'https://openrouter.ai/api/v1/chat/completions',
model: OPENROUTER_MODEL,
- extraHeaders: { 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws' },
+ extraHeaders: OPENROUTER_ATTRIBUTION_HEADERS,
}),
]);
}
diff --git a/api/_lib/llm-tool-chain.js b/api/_lib/llm-tool-chain.js
index e52a8e00d..a34b41a0d 100644
--- a/api/_lib/llm-tool-chain.js
+++ b/api/_lib/llm-tool-chain.js
@@ -11,6 +11,7 @@
import { env } from './env.js';
import { DEFAULT_FREE_MODEL, MODEL_CATALOG, resolveModelId } from './chat-models.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from './openrouter-attribution.js';
import {
vertexGeminiAvailable,
vertexGeminiModel,
@@ -54,7 +55,7 @@ export function providerChain() {
url: 'https://openrouter.ai/api/v1/chat/completions',
key,
model: DEFAULT_FREE_MODEL,
- extraHeaders: { 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws' },
+ extraHeaders: OPENROUTER_ATTRIBUTION_HEADERS,
});
});
if (env.NVIDIA_API_KEY) {
@@ -255,14 +256,14 @@ function singleLaneRung(model, meta) {
key: env.OPENROUTER_API_KEY,
model: anthropicMirrorId(model),
catalogModel: model,
- extraHeaders: { 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws' },
+ extraHeaders: OPENROUTER_ATTRIBUTION_HEADERS,
};
}
const lane = LANE_ENDPOINTS[meta.provider];
const key = lane?.key();
if (!lane || !key) return null;
const rung = { name: meta.provider, url: lane.url, key, model, catalogModel: model };
- if (meta.provider === 'openrouter') rung.extraHeaders = { 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws' };
+ if (meta.provider === 'openrouter') rung.extraHeaders = OPENROUTER_ATTRIBUTION_HEADERS;
return rung;
}
diff --git a/api/_lib/llm.js b/api/_lib/llm.js
index 567fc6b21..04f6dba54 100644
--- a/api/_lib/llm.js
+++ b/api/_lib/llm.js
@@ -46,6 +46,7 @@
import { env } from './env.js';
import { recordEvent } from './usage.js';
import { costMicroUsd } from './llm-pricing.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from './openrouter-attribution.js';
import { sql } from './db.js';
import {
vertexClaudeEnabled,
@@ -574,7 +575,7 @@ function openrouterProvider({ name, key, model }) {
key,
url: 'https://openrouter.ai/api/v1/chat/completions',
model,
- extraHeaders: { 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws' },
+ extraHeaders: OPENROUTER_ATTRIBUTION_HEADERS,
extraBody: { usage: { include: true } },
extractCostUsd: (r) => (Number.isFinite(r?.usage?.cost) ? r.usage.cost : null),
});
diff --git a/api/_lib/model-routes.js b/api/_lib/model-routes.js
index f4a978ab3..1e4e2069b 100644
--- a/api/_lib/model-routes.js
+++ b/api/_lib/model-routes.js
@@ -14,8 +14,9 @@
import { env } from './env.js';
import { getGcpAccessToken } from './gcp-auth.js';
import { rosterModel, vertexRouteUrl } from './model-roster.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from './openrouter-attribution.js';
-const OPENROUTER_HEADERS = { 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws' };
+const OPENROUTER_HEADERS = OPENROUTER_ATTRIBUTION_HEADERS;
// Keyed lanes: URL plus the env credential that unlocks them. OVH is keyless
// (its documented anonymous tier), so its key resolves to null and is allowed.
diff --git a/api/_lib/openrouter-attribution.js b/api/_lib/openrouter-attribution.js
new file mode 100644
index 000000000..facbbfe1d
--- /dev/null
+++ b/api/_lib/openrouter-attribution.js
@@ -0,0 +1,12 @@
+// Single source of truth for the headers that make an OpenRouter request count
+// toward three.ws's app page and Top Apps ranking (openrouter.ai/rankings).
+// HTTP-Referer is the required app identifier; X-OpenRouter-Title is the
+// current display-name header, with X-Title kept for callers still on the
+// older name. Every OpenRouter call site in this repo must spread this object
+// into its request headers instead of inlining its own values, so the title
+// three.ws reports never drifts between surfaces.
+export const OPENROUTER_ATTRIBUTION_HEADERS = Object.freeze({
+ 'HTTP-Referer': 'https://three.ws',
+ 'X-Title': 'three.ws',
+ 'X-OpenRouter-Title': 'three.ws',
+});
diff --git a/api/_lib/openrouter-free.js b/api/_lib/openrouter-free.js
index 430127734..056efe3a1 100644
--- a/api/_lib/openrouter-free.js
+++ b/api/_lib/openrouter-free.js
@@ -16,6 +16,8 @@
// as families/capabilities, and whatever is actually alive today wins. A future
// retirement rotates the fleet automatically rather than breaking chat.
+import { OPENROUTER_ATTRIBUTION_HEADERS } from './openrouter-attribution.js';
+
const MODELS_URL = 'https://openrouter.ai/api/v1/models';
const TTL_MS = 5 * 60 * 1000;
// Serve a stale list rather than nothing when OpenRouter is unreachable: a
@@ -76,8 +78,7 @@ export function rankFreeModels(models) {
async function fetchFreeModels(apiKey) {
const headers = {
- 'HTTP-Referer': 'https://three.ws',
- 'X-Title': 'three.ws chat',
+ ...OPENROUTER_ATTRIBUTION_HEADERS,
...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}),
};
// The public model list needs no key; an unkeyed deployment still gets a
diff --git a/api/_lib/vision.js b/api/_lib/vision.js
index 465f99b39..edb8ea876 100644
--- a/api/_lib/vision.js
+++ b/api/_lib/vision.js
@@ -35,6 +35,7 @@ import {
} from './provider-health.js';
import { recordEvent } from './usage.js';
import { costMicroUsd } from './llm-pricing.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from './openrouter-attribution.js';
import { validatePublicUrl, isPrivateAddress, SsrfError } from './ssrf.js';
import { fetchSafePublicUrl } from './ssrf-guard.js';
import {
@@ -286,14 +287,14 @@ export class VisionUnavailableError extends Error {
// the only shape difference from llm.js's text providers. `getHeaders` (async)
// replaces the static key header for keyless lanes whose auth is minted per
// request (the Vertex Gemini credits anchor).
-function openaiCompatVisionProvider({ name, key, url, model, getHeaders = null, extraBody = null }) {
+function openaiCompatVisionProvider({ name, key, url, model, getHeaders = null, extraBody = null, extraHeaders = null }) {
return {
name,
model,
url,
...(getHeaders
? { getHeaders }
- : { headers: { 'content-type': 'application/json', authorization: `Bearer ${key}` } }),
+ : { headers: { 'content-type': 'application/json', authorization: `Bearer ${key}`, ...(extraHeaders || {}) } }),
buildBody: (system, parts, maxTokens) => {
const messages = [];
if (system) messages.push({ role: 'system', content: system });
@@ -339,6 +340,7 @@ export function visionChain() {
url: 'https://openrouter.ai/api/v1/chat/completions',
model: spec.model,
extraBody: spec.extraBody || null,
+ extraHeaders: OPENROUTER_ATTRIBUTION_HEADERS,
}));
});
}
diff --git a/api/_lib/wallet-intents.js b/api/_lib/wallet-intents.js
index d240212ce..a35f7d2fa 100644
--- a/api/_lib/wallet-intents.js
+++ b/api/_lib/wallet-intents.js
@@ -42,6 +42,7 @@ import {
SOL_FEE_HEADROOM_LAMPORTS,
} from './agent-trade-guards.js';
import { THREE_MINT } from './networth-model.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from './openrouter-attribution.js';
import { XAI_CHAT_COMPLETIONS_URL, GROK_BUDGET_MODEL, GROK_BUDGET_EXTRA_BODY } from './chat-models.js';
import { resolveSolanaRecipient } from '../../src/solana/sns.js';
import { recentPumpLaunches, enrichCreatorStats } from './pump-launch-feed.js';
@@ -605,8 +606,7 @@ async function callOpenRouterCompile({ apiKey, system, messages }) {
headers: {
Authorization: `Bearer ${apiKey}`,
'content-type': 'application/json',
- 'HTTP-Referer': 'https://three.ws',
- 'X-Title': 'three.ws wallet intents',
+ ...OPENROUTER_ATTRIBUTION_HEADERS,
},
body: JSON.stringify({
model: 'openai/gpt-oss-120b',
diff --git a/api/_lib/watsonx.js b/api/_lib/watsonx.js
index fc9b73e56..0f4e55fac 100644
--- a/api/_lib/watsonx.js
+++ b/api/_lib/watsonx.js
@@ -12,6 +12,7 @@
// upstream failure throws so the proxy reports the real cause to the caller.
import { fetchUpstream } from './upstream-fetch.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from './openrouter-attribution.js';
const IAM_TOKEN_URL = 'https://iam.cloud.ibm.com/identity/token';
@@ -251,8 +252,7 @@ async function graniteOpenRouterFallback({ messages, maxTokens, temperature }) {
headers: {
'content-type': 'application/json',
authorization: `Bearer ${key}`,
- 'HTTP-Referer': 'https://three.ws',
- 'X-Title': 'three.ws',
+ ...OPENROUTER_ATTRIBUTION_HEADERS,
},
body: JSON.stringify({
model,
diff --git a/api/_lib/x-content/llm.js b/api/_lib/x-content/llm.js
index e08435b72..a9a2b8a96 100644
--- a/api/_lib/x-content/llm.js
+++ b/api/_lib/x-content/llm.js
@@ -17,6 +17,8 @@
// multimodal rungs are unfunded, drafting stays fast and reliable on it while
// review still routes to NVIDIA.
+import { OPENROUTER_ATTRIBUTION_HEADERS } from '../openrouter-attribution.js';
+
export const EDITOR_MODEL = 'claude-opus-5';
async function viaVertex({ system, parts }) {
@@ -102,7 +104,7 @@ export function modelRungs(request, env = process.env) {
return [
() => viaVertex(request),
() => viaChatCompletions(request, { url: 'https://api.groq.com/openai/v1/chat/completions', key: env.GROQ_API_KEY, model: 'openai/gpt-oss-120b', label: 'groq', textOnly: true }),
- () => viaChatCompletions(request, { url: 'https://openrouter.ai/api/v1/chat/completions', key: env.OPENROUTER_API_KEY, model: `anthropic/${EDITOR_MODEL}`, label: 'openrouter', extraHeaders: { 'http-referer': 'https://three.ws', 'x-title': 'three.ws editorial review' } }),
+ () => viaChatCompletions(request, { url: 'https://openrouter.ai/api/v1/chat/completions', key: env.OPENROUTER_API_KEY, model: `anthropic/${EDITOR_MODEL}`, label: 'openrouter', extraHeaders: OPENROUTER_ATTRIBUTION_HEADERS }),
() => viaChatCompletions(request, { url: 'https://api.openai.com/v1/chat/completions', key: env.OPENAI_API_KEY, model: 'gpt-5.5-pro', label: 'openai' }),
() => viaChatCompletions(request, { url: 'https://integrate.api.nvidia.com/v1/chat/completions', key: env.NVIDIA_API_KEY, model: 'moonshotai/kimi-k3', label: 'nvidia', maxTokens: RUNG_MAX_TOKENS }),
];
diff --git a/api/agents/solana-intent.js b/api/agents/solana-intent.js
index 9f49ae3d8..442d0e482 100644
--- a/api/agents/solana-intent.js
+++ b/api/agents/solana-intent.js
@@ -23,6 +23,7 @@ import { getSessionUser, authenticateBearer, extractBearer } from '../_lib/auth.
import { sql } from '../_lib/db.js';
import { cors, json, method, error, readJson, rateLimited } from '../_lib/http.js';
import { limits, clientIp } from '../_lib/rate-limit.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from '../_lib/openrouter-attribution.js';
import { loadUserProviderKeys } from '../_lib/provider-keys.js';
import { resolveSolanaRecipient } from '../../src/solana/sns.js';
import { THREE_MINT } from '../_lib/networth-model.js';
@@ -279,8 +280,7 @@ async function callOpenRouter({ apiKey, system, messages }) {
headers: {
Authorization: `Bearer ${apiKey}`,
'content-type': 'application/json',
- 'HTTP-Referer': 'https://three.ws',
- 'X-Title': 'three.ws conversational wallet',
+ ...OPENROUTER_ATTRIBUTION_HEADERS,
},
body: JSON.stringify({
model: OPENROUTER_MODEL,
diff --git a/api/agents/wallet-intents.js b/api/agents/wallet-intents.js
index 7f90d7325..3c02bf887 100644
--- a/api/agents/wallet-intents.js
+++ b/api/agents/wallet-intents.js
@@ -23,6 +23,7 @@ import { assertBearerMaySpend } from '../_lib/spend-scope.js';
import { limits } from '../_lib/rate-limit.js';
import { requireCsrf } from '../_lib/csrf.js';
import { requireRealFundsAgreement } from '../_lib/real-funds-agreement.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from '../_lib/openrouter-attribution.js';
import { sql } from '../_lib/db.js';
import { loadUserProviderKeys } from '../_lib/provider-keys.js';
import { getSpendLimits, getTradeLimits } from '../_lib/agent-trade-guards.js';
@@ -423,7 +424,7 @@ async function handleCopilot(req, res, id) {
if (r.ok) { const j = await r.json(); const t = (j.content || []).find((b) => b.type === 'text')?.text; if (t) { reply = t.trim(); provider = 'anthropic'; } }
} else if (orKey) {
const r = await fetch('https://openrouter.ai/api/v1/chat/completions', {
- method: 'POST', headers: { Authorization: `Bearer ${orKey}`, 'content-type': 'application/json', 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws wallet copilot' },
+ method: 'POST', headers: { Authorization: `Bearer ${orKey}`, 'content-type': 'application/json', ...OPENROUTER_ATTRIBUTION_HEADERS },
body: JSON.stringify({ model: 'openai/gpt-oss-120b', max_tokens: 300, messages: [{ role: 'system', content: sys }, { role: 'user', content: message }] }),
signal: AbortSignal.timeout(15_000),
});
diff --git a/api/avatars/_actions.js b/api/avatars/_actions.js
index eef681cd5..72ecc96ff 100644
--- a/api/avatars/_actions.js
+++ b/api/avatars/_actions.js
@@ -6,6 +6,7 @@ import { presignUpload, headObject, r2, publicUrl, putObject } from '../_lib/r2.
import { storageKeyFor, enforceQuotas, searchPublicAvatars, stripOwnerFor, assertAvatarSlotAvailable, isPlanLimitError, PLAN_LIMIT_JOB_ERROR, defaultAvatarVisibilityFor } from '../_lib/avatars.js';
import { listAvatars } from '../_lib/avatars.js';
import { env } from '../_lib/env.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from '../_lib/openrouter-attribution.js';
import { sql } from '../_lib/db.js';
import { cors, json, method, readJson, readBody, wrap, error, rateLimited } from '../_lib/http.js';
import { parse, presignUploadBody, slug as slugSchema, createAvatarBody } from '../_lib/validate.js';
@@ -893,7 +894,7 @@ async function classifyAvatarImage({ thumbUrl, prompt, env }) {
env.OPENROUTER_API_KEY,
'https://openrouter.ai/api/v1/chat/completions',
'meta-llama/llama-3.2-11b-vision-instruct',
- { 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws avatar auto-tag' },
+ OPENROUTER_ATTRIBUTION_HEADERS,
));
}
if (env.NVIDIA_API_KEY) {
diff --git a/api/brain/chat.js b/api/brain/chat.js
index b73d49918..35c585a8b 100644
--- a/api/brain/chat.js
+++ b/api/brain/chat.js
@@ -19,6 +19,7 @@ import { cors, method, readJson, error, wrap, rateLimited } from '../_lib/http.j
import { getSessionUser, authenticateBearer, extractBearer } from '../_lib/auth.js';
import { limits, clientIp } from '../_lib/rate-limit.js';
import { watsonxConfig, watsonxChatRequest } from '../_lib/watsonx.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from '../_lib/openrouter-attribution.js';
import {
DEFAULT_FREE_MODEL,
modelThinksByDefault,
@@ -627,7 +628,7 @@ function openrouter(key = openrouterKeys()[0]) {
const model = createOpenAI({
apiKey: key,
baseURL: 'https://openrouter.ai/api/v1',
- headers: { 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws brain' },
+ headers: OPENROUTER_ATTRIBUTION_HEADERS,
fetch: openrouterUsageFetch((usd) => {
cell.usd = usd;
}),
diff --git a/api/chat.js b/api/chat.js
index 6bfd51cc3..6104f19c1 100644
--- a/api/chat.js
+++ b/api/chat.js
@@ -30,6 +30,7 @@ import { cors, json, method, readJson, wrap, error, rateLimited } from './_lib/h
import { parse } from './_lib/validate.js';
import { recordEvent } from './_lib/usage.js';
import { trackAgentOwnerVisit } from './_lib/retention.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from './_lib/openrouter-attribution.js';
import { costMicroUsd } from './_lib/llm-pricing.js';
import { captureException } from './_lib/sentry.js';
import { sql } from './_lib/db.js';
@@ -149,7 +150,7 @@ const PROVIDERS = {
defaultModel: DEFAULT_OPENROUTER_MODEL,
url: 'https://openrouter.ai/api/v1/chat/completions',
style: 'openai',
- extraHeaders: { 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws agent' },
+ extraHeaders: OPENROUTER_ATTRIBUTION_HEADERS,
},
groq: {
envKey: 'GROQ_API_KEY',
diff --git a/api/chat/proxy.js b/api/chat/proxy.js
index f6cfe902b..62ee3133d 100644
--- a/api/chat/proxy.js
+++ b/api/chat/proxy.js
@@ -2,6 +2,7 @@ import { env } from '../_lib/env.js';
import { cors, error, json, method, wrap, readJson, rateLimited } from '../_lib/http.js';
import { limits, clientIp } from '../_lib/rate-limit.js';
import { isFreeModelId, isLiveFreeModel, pickDefaultFreeModel } from '../_lib/openrouter-free.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from '../_lib/openrouter-attribution.js';
import { AGENT_MODEL_ID, runAgentCompletion } from '../agent/run.js';
const UPGRADE_URL = `${env.APP_ORIGIN}/pricing`;
@@ -122,8 +123,7 @@ export default wrap(async (req, res) => {
headers: {
Authorization: `Bearer ${key}`,
'Content-Type': 'application/json',
- 'HTTP-Referer': 'https://three.ws',
- 'X-Title': 'three.ws chat',
+ ...OPENROUTER_ATTRIBUTION_HEADERS,
},
body: JSON.stringify({ ...body, model: activeModel }),
signal: headersCtrl.signal,
diff --git a/api/llm/anthropic.js b/api/llm/anthropic.js
index 135c4a377..34fa5bc06 100644
--- a/api/llm/anthropic.js
+++ b/api/llm/anthropic.js
@@ -15,6 +15,7 @@ import { env } from '../_lib/env.js';
import { getRedis as _getSharedRedis } from '../_lib/redis.js';
import { cors, error, method, wrap, readJson, json, rateLimited } from '../_lib/http.js';
import { parse } from '../_lib/validate.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from '../_lib/openrouter-attribution.js';
import { limits, clientIp } from '../_lib/rate-limit.js';
import { getRequestUser } from '../_lib/auth.js';
import { recordEvent, logger } from '../_lib/usage.js';
@@ -689,9 +690,7 @@ export default wrap(async (req, res) => {
headers: {
'content-type': 'application/json',
authorization: `Bearer ${apiKey}`,
- ...(route.provider === 'openrouter'
- ? { 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws agent' }
- : {}),
+ ...(route.provider === 'openrouter' ? OPENROUTER_ATTRIBUTION_HEADERS : {}),
},
body: JSON.stringify(
anthropicBodyToOpenAI({ ...body, model: usedModel }, { provider: route.provider }),
diff --git a/api/marketplace/[action].js b/api/marketplace/[action].js
index 269a3078a..d6d496fe8 100644
--- a/api/marketplace/[action].js
+++ b/api/marketplace/[action].js
@@ -25,6 +25,7 @@ import { pedigreeScore } from '../_lib/genome.js';
import { clientIp, limits } from '../_lib/rate-limit.js';
import { requireCsrf } from '../_lib/csrf.js';
import { markProviderCooldown, AUTH_COOLDOWN_SECONDS } from '../_lib/provider-health.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from '../_lib/openrouter-attribution.js';
import {
vertexGeminiAvailable,
vertexGeminiModel,
@@ -893,10 +894,7 @@ const PREVIEW_PROVIDERS = {
url: 'https://openrouter.ai/api/v1/chat/completions',
defaultModel: 'google/gemma-4-31b-it:free',
style: 'openai',
- extraHeaders: {
- 'HTTP-Referer': 'https://three.ws',
- 'X-Title': 'three.ws marketplace',
- },
+ extraHeaders: OPENROUTER_ATTRIBUTION_HEADERS,
},
groq: {
envKey: 'GROQ_API_KEY',
diff --git a/api/widgets/[id]/[action].js b/api/widgets/[id]/[action].js
index fa29b4076..2c86fcd62 100644
--- a/api/widgets/[id]/[action].js
+++ b/api/widgets/[id]/[action].js
@@ -10,6 +10,7 @@ import { z } from 'zod';
import { sql } from '../../_lib/db.js';
import { getSessionUser, authenticateBearer, extractBearer, hasScope } from '../../_lib/auth.js';
import { cors, json, method, readJson, wrap, error, rateLimited } from '../../_lib/http.js';
+import { OPENROUTER_ATTRIBUTION_HEADERS } from '../../_lib/openrouter-attribution.js';
import { requireCsrf } from '../../_lib/csrf.js';
import { parse } from '../../_lib/validate.js';
import { csvCell } from '../../_lib/csv.js';
@@ -80,7 +81,7 @@ const PROVIDERS = {
defaultModel: PROVIDER_MODEL_DEFAULTS.openrouter,
url: 'https://openrouter.ai/api/v1/chat/completions',
style: 'openai',
- extraHeaders: { 'HTTP-Referer': 'https://three.ws', 'X-Title': 'three.ws widget' },
+ extraHeaders: OPENROUTER_ATTRIBUTION_HEADERS,
},
groq: {
envKey: 'GROQ_API_KEY',