# openai-cookbook | OpenAI | Knowledge Base | Instagit

Examples and guides for using the OpenAI API

GitHub Stars: 71.8k

Repository: https://github.com/openai/openai-cookbook

---

## Articles

### [How to Implement Out-of-Band Transcription with OpenAI Realtime Sessions](/openai/openai-cookbook/implementing-out-of-band-transcription-with-realtime-sessions)

Learn to implement out-of-band transcription with OpenAI Realtime sessions. Generate verbatim transcripts without altering conversation state by setting conversation none in response create.

- Tags: how-to-guide
- Published: 2026-03-02

### [How to Build Tool-Using Agents with LangChain](/openai/openai-cookbook/how-to-build-tool-using-agents-with-langchain)

Learn to build tool-using agents with LangChain. Implement a ReAct loop using custom prompts, structured output, and AgentExecutor to let LLMs use external tools dynamically.

- Tags: how-to-guide
- Published: 2026-03-02

### [Implementing Self-Evolving Agents with Autonomous Retraining: A Complete Guide](/openai/openai-cookbook/implementing-self-evolving-agents-with-autonomous-retraining)

Build self-evolving agents with autonomous retraining using OpenAI's Assistants API and reflection logging for continuous improvement. Automate model fine-tuning without human intervention.

- Tags: how-to-guide
- Published: 2026-03-02

### [Best Practices for Context Engineering in the OpenAI Agents SDK](/openai/openai-cookbook/best-practices-for-context-engineering-in-agents-sdk)

Master context engineering for OpenAI Agents SDK with best practices. Learn to chunk knowledge, compose structured prompts, and leverage the reasoning field for clearer AI responses. Enhance your agent's performance today.

- Tags: best-practices
- Published: 2026-03-02

### [How to Evaluate Image Inputs with the OpenAI Evals API: A Complete Guide](/openai/openai-cookbook/evaluating-image-inputs-with-the-evals-api)

Learn to evaluate image inputs with the OpenAI Evals API. Get a complete guide to automating end-to-end model evaluation with structured, reproducible scores using LLM-based grading.

- Tags: how-to-guide
- Published: 2026-03-02

### [Building Supply Chain Copilots with Databricks MCP Servers: A Complete Implementation Guide](/openai/openai-cookbook/building-supply-chain-copilots-with-databricks-mcp-servers)

Build supply chain copilots with Databricks MCP servers and OpenAI Agents SDK. Query live data, leverage vector search, and Unity Catalog with LLM tools for powerful automation.

- Tags: how-to-guide
- Published: 2026-03-02

### [Using the Seed Parameter for Reproducible Outputs in OpenAI's API](/openai/openai-cookbook/using-the-seed-parameter-for-reproducible-outputs)

Achieve reproducible outputs with OpenAI API using the seed parameter. Learn how to anchor random number generation for consistent results with the system fingerprint for detecting changes.

- Tags: how-to-guide
- Published: 2026-03-02

### [Implementing Multi-Tool Orchestration with RAG Using the OpenAI Responses API](/openai/openai-cookbook/implementing-multi-tool-orchestration-with-rag-approach)

Implement multi-tool orchestration with RAG to dynamically route queries across vector stores, web search, and file indexes for advanced information retrieval. Learn more.

- Tags: how-to-guide
- Published: 2026-03-02

### [Building Temporal Agents with Knowledge Graphs for Retrieval: A Complete Guide](/openai/openai-cookbook/building-temporal-agents-with-knowledge-graphs-for-retrieval)

Learn to build temporal agents using knowledge graphs for retrieval. This guide shows how to store time-aware facts in a SQLite graph that invalidates stale predictions and tracks entity evolution.

- Tags: how-to-guide
- Published: 2026-03-02

### [How to Use Prompt Caching to Reduce OpenAI API Costs](/openai/openai-cookbook/how-to-use-prompt-caching-to-reduce-api-costs)

Reduce OpenAI API costs with prompt caching. Learn how this technique cuts input token costs by up to 90% and slashes latency for long prompts.

- Tags: tutorial
- Published: 2026-03-02

### [Implementing Code Execution Plans with Codex CLI and PLANS.md: A Complete Guide](/openai/openai-cookbook/implementing-code-execution-plans-with-codex-cli-and-plans-md)

Automate multi-step development with Codex CLI and PLANS.md. Store milestones and commands in PLANS.md for iterative code planning, editing, validation, and repair.

- Tags: how-to-guide
- Published: 2026-03-02

### [Building Voice Agents with the OpenAI Realtime API: Architecture and Code Examples](/openai/openai-cookbook/building-voice-agents-with-the-realtime-api)

Learn to build voice agents with the OpenAI Realtime API. Explore a production-ready reference implementation with ESP-32, Deno, and React. Get code examples now.

- Tags: how-to-guide
- Published: 2026-03-02

### [How to Fine-tune GPT-4o for Visual Question Answering: A Complete Guide](/openai/openai-cookbook/fine-tuning-gpt-4o-for-visual-question-answering-tasks)

Master fine-tuning GPT-4o for visual question answering with this comprehensive guide. Enhance your model's visual reasoning on specialized datasets like OCR-VQA for improved accuracy.

- Tags: tutorial
- Published: 2026-03-02

### [Using the MCP Tool to Connect External Services in the OpenAI Responses API](/openai/openai-cookbook/using-the-mcp-tool-to-connect-external-services-in-the-responses-api)

Learn to connect external services like custom search engines or databases to the OpenAI Responses API using the MCP tool. Integrate JSON results seamlessly into model reasoning by hosting your own MCP server.

- Tags: how-to-guide
- Published: 2026-03-02

### [Implementing Reinforcement Fine-Tuning with Model Graders: The OpenAI Cookbook Approach](/openai/openai-cookbook/implementing-reinforcement-fine-tuning-with-model-graders)

Learn to implement reinforcement fine-tuning with model graders using the OpenAI Cookbook. Build a continuous improvement loop for better AI model outputs.

- Tags: how-to-guide
- Published: 2026-03-02

### [How to Handle Rate Limits in Production Environments with the OpenAI API](/openai/openai-cookbook/how-to-handle-rate-limits-in-production-environments)

Effectively manage OpenAI API rate limits in production. Learn strategies like exponential backoff, real-time RPM TPM tracking, and model fallbacks for smooth operations. Avoid costly interruptions.

- Tags: best-practices
- Published: 2026-03-02

### [How to Configure Function Calling with the o3 and o4-mini Models](/openai/openai-cookbook/how-to-configure-function-calling-with-the-new-o3-o4-mini-models)

Learn to configure function calling with OpenAI's o3-mini and o4-mini models. Set model identifiers, register function schemas, and control tool choice for efficient AI integration.

- Tags: how-to-guide
- Published: 2026-03-02

### [Implementing RAG with Vector Databases like Pinecone and Weaviate: A Complete Guide](/openai/openai-cookbook/implementing-rag-with-vector-databases-like-pinecone-and-weaviate)

Learn to implement RAG with vector databases like Pinecone and Weaviate. This guide explains chunking, embeddings, storage, retrieval, and prompt injection for grounded LLM answers.

- Tags: how-to-guide
- Published: 2026-03-02

### [How to Use the Responses API for Reasoning Models with Reasoning Items](/openai/openai-cookbook/how-to-use-the-responses-api-for-reasoning-models-with-reasoning-items)

Discover how to use the Responses API for reasoning models and items. Persist chain-of-thought tokens with reasoning IDs across turns for enhanced AI interactions.

- Tags: how-to-guide
- Published: 2026-03-02

### [Troubleshooting Common Issues in GPT-5 Implementations: A Complete Guide](/openai/openai-cookbook/troubleshooting-common-issues-in-gpt-5-implementations)

Fix common GPT-5 implementation problems. Learn to resolve API errors, troubleshoot instruction blocks, and handle serverless exceptions with this comprehensive guide from the OpenAI cookbook.

- Tags: how-to-guide
- Published: 2026-03-02

### [How to Build Multi-Agent Portfolio Collaboration Workflows Using the OpenAI Agents SDK](/openai/openai-cookbook/how-to-build-multi-agent-portfolio-collaboration-workflows-using-agents-sdk)

Build multi-agent portfolio collaboration workflows with the OpenAI Agents SDK. Orchestrate specialist analyses, cut latency, and maintain observability with this powerful architecture.

- Tags: how-to-guide
- Published: 2026-03-02

### [Best Practices for Prompt Optimization with GPT-5's New Optimizer](/openai/openai-cookbook/best-practices-for-prompt-optimization-with-gpt-5s-new-optimizer)

Discover prompt optimization best practices for GPT-5 using the new optimizer. Learn how it detects and corrects inconsistencies for optimal GPT-5 performance.

- Tags: best-practices
- Published: 2026-03-02

### [How to Implement Session Memory with Agents SDK for Short-Term Memory Management](/openai/openai-cookbook/how-to-implement-session-memory-with-agents-sdk-for-short-term-memory-management)

Learn to implement session memory with the Agents SDK. Use custom TrimmingSession or SummarizingSession for effective short-term memory management and token limit control.

- Tags: how-to-guide
- Published: 2026-03-02

