# How to set additional http headers when creating a model

**URL:** https://forum.langchain.com/t/how-to-set-additional-http-headers-when-creating-a-model/2354
**Category:** LangChain
**Tags:** js-help
**Created:** [November 26, 2025, 11:30pm UTC](https://forum.langchain.com/t/how-to-set-additional-http-headers-when-creating-a-model/2354 "2025-11-26T23:30:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dave.robinson](https://avatars.discourse-cdn.com/v4/letter/d/e36b37/32.png) [@dave.robinson](https://forum.langchain.com/u/dave.robinson)
#### Post date: [November 26, 2025, 11:30pm UTC](https://forum.langchain.com/t/how-to-set-additional-http-headers-when-creating-a-model/2354/1 "2025-11-26T23:30:30Z")

</div>

Using LangChain with Typescript and working with google-genai, I want to use initChatModel so that I can have support for other model providers. My GOOGLE\_API\_KEY requires a specific `referer` http header to be set. I have not been able to find documentation or solutions through AI on how to properly do this.

With google’s genai library I do this to set it when creating the client:

```typescript
new GoogleGenAI({
      apiKey,
      httpOptions: { headers: { referer }, timeout: 600000 },
    });

```

I’ve tried a lot of different combinations with LangChain using `initChatModel` but nothing seems to work. Here is my latest attempt:

```typescript
await initChatModel(modelName, {
          thinkingConfig: { thinkingBudget: this.thinkingBudget },
          clientOptions: {
            httpOptions: {
              headers: { referer: this.referer },
            },
          },
        })

```

Does anyone know if there is a way to do this?
