> ## Documentation Index
> Fetch the complete documentation index at: https://docs.helicone.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Secret vs Public Key

> Understanding the difference between secret and public API keys in Helicone. Learn about access levels, usage examples, and best practices.

| Key Type   | Access       | Path Auth       | Header Auth | REST API |
| ---------- | ------------ | --------------- | ----------- | -------- |
| **Public** | Write-Only   | Yes             | Yes         | No       |
| **Secret** | Read + Write | Not Recommended | Yes         | Yes      |

### Usage Examples

<CodeGroup>
  ```javascript Header Auth theme={null}
  import OpenAI from "openai";

  // Use secret or public key
  const openai = new OpenAI({
    apiKey: request.env.OPENAI_API_KEY,
    baseURL: "https://oai.helicone.ai/v1",
    defaultHeaders: {
      "Helicone-Auth": `Bearer ${HELICONE_SECRET_API_KEY}`,
    },
  });
  ```

  ```javascript Path Auth theme={null}
  import OpenAI from "openai";

  // Use public key
  const openai = new OpenAI({
    apiKey: request.env.OPENAI_API_KEY,
    baseURL: `https://oai.helicone.ai/${HELICONE_PUBLIC_API_KEY}/v1`,
  });
  ```
</CodeGroup>

<Note>
  Ensure that secret keys are always kept secure and never exposed in
  client-side code.
</Note>

***

<Accordion title="Need more help?">
  Additional questions or feedback? Reach out to
  [help@helicone.ai](mailto:help@helicone.ai) or [schedule a
  call](https://cal.com/team/helicone/helicone-discovery) with us.
</Accordion>
