---
title: "Discussion on \"OpenAI API from Next.js Route Handlers: Keys, Streaming, and Safety\" | Hashnode"
description: "Discussion on \"OpenAI API from Next.js Route Handlers: Keys, Streaming, and Safety\". Proxy OpenAI calls from the server so API keys stay secret. Use official OpenAI SDK patterns and handle errors for Chat Completions or Responses API."
url: "https://hashnode.com/posts/openai-api-nextjs-route-handlers/69e4a6225033e45051cc08a6"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [OpenAI API from Next.js Route Handlers: Keys, Streaming, and Safety](https://ganeshjoshi.hashnode.dev/openai-api-nextjs-route-handlers?utm_source=hashnode&utm_medium=feed)

Proxy OpenAI calls from the server so API keys stay secret. Use official OpenAI SDK patterns and handle errors for Chat Completions or Responses API.

Apr 19 · 1 min read · ganeshjoshi.hashnode.dev  
Read the article

-   [#api](https://hashnode.com/tag/api)
-   [#gpt](https://hashnode.com/tag/gpt)
-   [#nextjs](https://hashnode.com/tag/nextjs)
-   [#openai](https://hashnode.com/tag/openai)

## Written by

[Ganesh Joshi](https://hashnode.com/@ganeshjoshi)

@ganeshjoshi

  
[View profile](https://hashnode.com/@ganeshjoshi)

Full-stack developer

Full-stack developer • Writing about web dev, TypeScript &amp; building in public, using AI to create blogs

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
