[metadata]
astro-view-transitions-enabled: true
astro-view-transitions-fallback: swap
description: An overview of error codes from the OpenAI API and Python library, including solutions and guidance.
generator: Astro v6.0.4
og:description: An overview of error codes from the OpenAI API and Python library, including solutions and guidance.
og:image: https://developers.openai.com/og/api/docs/guides/error-codes.png
og:image:alt: Error codes | OpenAI API
og:image:height: 630
og:image:width: 1200
og:site_name: OpenAI Developers
og:title: Error codes | OpenAI API
og:type: website
og:url: https://developers.openai.com/api/docs/guides/error-codes
title: Error codes | OpenAI API
twitter:card: summary_large_image
twitter:description: An overview of error codes from the OpenAI API and Python library, including solutions and guidance.
twitter:image: https://developers.openai.com/og/api/docs/guides/error-codes.png
twitter:image:alt: Error codes | OpenAI API
twitter:image:height: 630
twitter:image:width: 1200
twitter:site: @OpenAIDevs
twitter:title: Error codes | OpenAI API
twitter:url: https://developers.openai.com/api/docs/guides/error-codes
viewport: width=device-width,initial-scale=1

[canonical-links]
https://developers.openai.com/api/docs/guides/error-codes

[document-links]
AGENTS.md: /codex/agent-configuration/agents-md
API Dashboard: https://platform.openai.com/login
API Partner Setup: /ads/api-partner-setup
API Reference: /api/docs/api-reference/
API key: https://platform.openai.com/settings/organization/api-keys
API reference: /api/reference/overview
API: /api/docs
API: /api/docs/introduction
API: /blog/topic/api
AWS: /api/docs/guides/workload-identity-federation/aws
Access tokens: /codex/enterprise/access-tokens
Accuracy optimization: /api/docs/guides/optimizing-llm-accuracy
Actions: /api/docs/guides/chatkit-actions
Ad Account: /ads/api-reference/ad-account
Ad Groups: /ads/api-reference/ad-groups
Add UI to your MCP server (optional): /plugins/build/chatgpt-ui
Add credits: https://platform.openai.com/settings/organization/billing
Admin APIs: /api/docs/guides/admin-apis
Admin rollout guide: /codex/enterprise/admin-setup
Ads Overview: /ads
Ads Publish and measure ads in ChatGPT: /ads
Ads: /ads/api-reference/ads
Advanced Config: /codex/config-file/config-advanced
Advanced integrations: /api/docs/guides/custom-chatkit
Agent approvals & security: /codex/agent-approvals-security
Agent definitions: /api/docs/guides/agents/define-agents
Agents: /api/docs/guides/agents
Agents: /cookbook/topic/agents
Agents: /learn/agents
All posts: /blog
Amazon Bedrock: /api/docs/guides/amazon-bedrock
Amazon Bedrock: /codex/amazon-bedrock
Analytics API: /codex/enterprise/analytics-api
App Server: /codex/app-server
Apply Patch: /api/docs/guides/tools-apply-patch
Apps SDK: /blog/topic/apps-sdk
Appshots: /codex/appshots
Audio & Voice: /learn/audio
Audio and speech: /api/docs/guides/audio
Audio: /blog/topic/audio
Authenticate users: /plugins/build/auth
Authenticate with Workspace Agent access tokens: /workspace-agents/authentication
Authentication overview: /codex/auth
Authentication: /ads/api-reference/authentication
Auto-review: /codex/sandboxing/auto-review
Background mode: /api/docs/guides/background
Batch: /api/docs/guides/batch
Best practices: /api/docs/guides/evaluation-best-practices
Best practices: /api/docs/guides/fine-tuning-best-practices
Best practices: /commerce/guides/best-practices
Blog Learnings and experiences from developers: /blog
Brainstorm use cases: /plugins/plan/use-case
Browser: /codex/browser
Build an MCP server: /plugins/build/mcp-server
Build plugins: /codex/build-plugins
Build skills: /codex/build-skills
Build skills: /plugins/build/skills
Bulk API: /ads/bulk-api
CLI customization: /codex/cli-customization
Campaign Targeting: /ads/campaign-targeting
Campaigns: /ads/api-reference/campaigns
Changelog: /api/docs/changelog
Changelog: /codex/changelog
Changelog: /codex/security/plugin/changelog
Changelog: /plugins/changelog
ChatGPT Work admin FAQ: /codex/enterprise/work-admin-faq
ChatGPT desktop app: /codex/app
ChatGPT on the web: /codex/web
ChatGPT: /
ChatGPT: /chatgpt
ChatGPT: /cookbook/topic/chatgpt
Checkout API reference: /plugins/build/monetization
Chrome extension: /codex/chrome-extension
Chronicle: /codex/customization/chronicle
Citation formatting: /api/docs/guides/citation-formatting
Cloud environment: /codex/environments/cloud-environment
Code generation: /api/docs/guides/code-generation
Code interpreter: /api/docs/guides/tools-code-interpreter
Code review: /codex/code-review
Codex Ambassadors: /community/codex-ambassadors
Codex Ambassadors: https://developers.openai.com/community/codex-ambassadors
Codex CLI: /codex/cli
Codex IDE extension: /codex/ide
Codex Micro: /codex/features/codex-micro
Codex SDK: /codex/codex-sdk
Codex cloud: /codex/cloud
Codex for Open Source: /community/codex-for-oss
Codex for Open Source: https://developers.openai.com/community/codex-for-oss
Codex for Students: /community/students
Codex for Students: https://developers.openai.com/community/students
Codex: /blog/topic/codex
Codex: /cookbook/topic/codex
Codex: /learn/codex
Codex: https://learn.chatgpt.com/docs
Collections: /codex/use-cases/collections
Commands: /codex/reference/commands
Commerce Build commerce flows in ChatGPT: /commerce
Community Programs, meetups, and support for builders: /community
Community: /community
Compaction: /api/docs/guides/compaction
Company blog: https://openai.com/news/
Compliance API and audit events: /codex/enterprise/compliance-api
Computer Use: /learn/cua
Computer use: /api/docs/guides/tools-computer-use
Computer use: /codex/computer-use
Config Basics: /codex/config-file/config-basic
Config Reference: /codex/config-file/config-reference
Connect and test your plugin: /plugins/deploy/connect-chatgpt
Content provenance: /api/docs/guides/content-provenance
Conversation state: /api/docs/guides/conversation-state
Conversion Setup: /ads/api-reference/conversion-setup
Conversion-Optimized Campaigns: /ads/conversion-optimized-campaigns
Conversions API: /ads/conversions-api
Cookbook Notebook examples for building with OpenAI models: /cookbook
Cookbook on GitHub: https://github.com/openai/openai-cookbook
Cost optimization: /api/docs/guides/cost-optimization
Counting tokens: /api/docs/guides/token-counting
Custom Code Review rules for Codex: /blog/custom-code-review-rules-for-codex
Customize: /api/docs/guides/chatkit-themes
Cyber Safety: /codex/cyber-safety
Cybersecurity checks: /api/docs/guides/safety-checks/cybersecurity
Deep dive: /api/docs/assistants/deep-dive
Deep research: /api/docs/guides/deep-research
Define tools: /plugins/plan/tools
Demo apps: /learn/code
Deployment checklist: /api/docs/guides/deployment-checklist
Deprecations: /api/docs/deprecations
Designing delightful frontends with GPT-5.4: /blog/designing-delightful-frontends-with-gpt-5-4
Desktop app: /codex/windows/windows-app
Developer Forum: https://community.openai.com/
Developer blog: https://developers.openai.com/blog
Developer commands: /codex/developer-commands
Developer settings: /codex/developer-settings
Direct preference optimization: /api/docs/guides/direct-preference-optimization
Discord: https://discord.com/invite/openai
Docs Guides, concepts, and product docs for Codex: https://learn.chatgpt.com/docs
Docs MCP: /learn/docs-mcp
Docs: /codex
Docs: https://learn.chatgpt.com/docs
Embeddings: /api/docs/guides/embeddings
Environment Variables: /codex/config-file/environment-variables
Error codes: /api/docs/guides/error-codes
Evals: /cookbook/topic/evals
Evals: /learn/evals
Evaluate agent workflows: /api/docs/guides/agent-evals
Examples: /plugins/build/examples
Explore use cases: /codex/use-cases
Export and track findings: /codex/security/plugin/export-findings
External models: /api/docs/guides/external-models
FAQ: /codex/security/cli/faq
FAQ: /codex/security/faq
Fast mode: /api/docs/guides/fast-mode
Feature Maturity: /codex/feature-maturity
Feeds: /commerce/specs/api/feeds
File inputs: /api/docs/guides/file-inputs
File search: /api/docs/guides/tools-file-search
File transcription: /api/docs/guides/speech-to-text
Files: /ads/api-reference/files
Fine-tuning: /learn/fine-tuning
Fix findings: /codex/security/plugin/fix-findings
Flex processing: /api/docs/guides/flex-processing
Frontend prompting: /api/docs/guides/frontend-prompt
Function calling: /api/docs/guides/function-calling
General settings: https://platform.openai.com/settings/organization/general
General: /blog/topic/general
Get Quote spec: /plugins/guides/local-services-request-quote-conversion-spec
Get started with Work: /codex/get-started-with-work
Get started: /commerce/guides/get-started
Getting started: /api/docs/guides/evaluation-getting-started
Git worktrees: /codex/environments/git-worktrees
GitHub Action: /codex/github-action
GitHub Actions: /api/docs/guides/workload-identity-federation/github-actions
GitHub: /codex/third-party/github
Glossary: /codex/glossary
Google Cloud: /api/docs/guides/workload-identity-federation/google-cloud
Governance: /codex/enterprise/governance
Graders: /api/docs/guides/graders
Groups and provisioning: /codex/enterprise/groups-and-provisioning
Guardrails: /api/docs/guides/agents/guardrails-approvals
Guardrails: /cookbook/topic/guardrails
HIPAA configuration: /codex/hipaa-configuration
Home: /
Home: /api/docs
Home: /codex
Home: /codex/resources
Home: /commerce
Home: /cookbook
Home: /learn
Home: /plugins
Home: /workspace-agents
Hooks: /codex/hooks
How Perplexity Brought Voice Search to Millions Using the Realtime API: /blog/realtime-perplexity-computer
IP allowlist settings: https://platform.openai.com/settings/organization/security/ip-allowlist
IP egress ranges: /api/docs/guides/ip-addresses
Image Tag: /ads/image-tag
Image generation: /api/docs/guides/image-generation
Image generation: /api/docs/guides/tools-image-generation
Image generation: /codex/image-generation
Image generation: /learn/imagegen
Image inputs: /codex/image-inputs
Images and vision: /api/docs/guides/images-vision
Import and reconciliation: /api/docs/guides/terraform/import-and-reconcile
Import from another agent: /codex/import
Improving the threat model: /codex/security/threat-model
Insights: /ads/api-reference/insights
Integrated terminal: /codex/integrated-terminal
Integrations and observability: /api/docs/guides/agents/integrations-observability
Internet access: /codex/cloud/internet-access
Key concepts: /api/docs/concepts
Kubernetes: /api/docs/guides/workload-identity-federation/kubernetes
Latency optimization: /api/docs/guides/latency-optimization
Learn Docs, videos, and demo apps for building with OpenAI: /learn
Linear: /codex/third-party/linear
Live translation: /api/docs/guides/realtime-translation
Local environments: /codex/environments/local-environment
Local shell: /api/docs/guides/tools-local-shell
Long-running work: /codex/long-running-work
MCP Server: /codex/mcp-server
MCP and Connectors: /api/docs/guides/tools-connectors-mcp
MCP server review requirements: /plugins/deploy/app-review
MCP server: /plugins/concepts/mcp-server
MCP: /codex/extend/mcp
Making private MCP servers reachable without making them public: /blog/connect-private-mcp-servers-to-openai-products
Manage app updates: /codex/enterprise/manage-app-updates
Managed configuration: /codex/enterprise/managed-configuration
Managing conversations: /api/docs/guides/realtime-conversations
Managing costs: /api/docs/guides/realtime-costs
Mastering remote engineering work from your phone: /blog/mastering-codex-remote-for-engineering
Measurement Pixel: /ads/measurement-pixel
Meetups: /community/meetups
Meetups: https://developers.openai.com/community/meetups
Memories: /codex/customization/memories
Microsoft Azure: /api/docs/guides/workload-identity-federation/microsoft-azure
Migration guide: /api/docs/assistants/migration
Migration guide: /api/docs/guides/agent-builder/migrate-from-agent-builder
Migration guide: /api/docs/guides/prompting/migrate-from-prompt-object
Model catalog: /api/docs/models
Model selection: /api/docs/guides/model-selection
Model, tool, and data controls: /api/docs/guides/terraform/project-controls
Models and providers: /api/docs/guides/agents/models
Models: /api/docs/models
Models: /codex/models
Moderation: /api/docs/guides/moderation
Modes: /codex/environments/modes
Multi-agent: /api/docs/guides/responses-multi-agent
Multimodal: /cookbook/topic/multimodal
Multiple Pixels (Advanced): /ads/multiple-pixels
Node reference: /api/docs/guides/node-reference
Non-interactive mode: /codex/non-interactive-mode
Notifications: /codex/notifications
Online trainings: https://academy.openai.com/home/events
Open Source: /codex/open-source
OpenAI Academy: https://openai.com/academy/
OpenAI CLI: /api/docs/libraries/openai-cli
OpenAI Crawlers: /api/docs/bots
OpenAI Developers plugin: /learn/developers-codex-plugin
OpenAI SDK: /api/docs/libraries
OpenAI for Startups: https://openai.com/business/why-openai/startups/
Optimization cycle: /api/docs/guides/model-optimization
Optimization: /cookbook/topic/optimization
Optimize Metadata: /plugins/guides/optimize-metadata
Oracle Cloud Infrastructure: /api/docs/guides/workload-identity-federation/oracle-cloud
Orchestration: /api/docs/guides/agents/orchestration
Overview: /ads/api-overview
Overview: /api/docs
Overview: /api/docs/guides/agent-builder
Overview: /api/docs/guides/agents
Overview: /api/docs/guides/chatkit
Overview: /api/docs/guides/prompting
Overview: /api/docs/guides/realtime
Overview: /api/docs/guides/terraform
Overview: /api/docs/guides/tools
Overview: /codex/administration
Overview: /codex/configuration
Overview: /codex/customization/overview
Overview: /codex/developers
Overview: /codex/features
Overview: /codex/security
Overview: /codex/security-administration
Overview: /commerce/specs/api/overview
Overview: /commerce/specs/file-upload/overview
Package your plugin: /plugins/build/plugins
Permissions: /api/docs/guides/rbac
Permissions: /codex/permission-modes
Personalize ChatGPT: /codex/personalize
Pets: /codex/pets
Plugin UI reference: /plugins/reference
Plugin architecture: /plugins/concepts/plugins
Plugin controls: /codex/enterprise/apps-and-connectors
Plugin guidelines: /plugins/app-guidelines
Plugins Extend ChatGPT and Codex: /plugins
Plugins: /codex/plugins
Predicted Outputs: /api/docs/guides/predicted-outputs
Pricing: /api/docs/pricing
Pricing: /codex/pricing
Prisma AIRS: /codex/enterprise/prisma-airs
Private Link: /api/docs/guides/private-link
Product Feeds: /ads/product-feeds
Product checkout spec: /plugins/guides/product-checkout-conversion-spec
Production best practices: /api/docs/guides/production-best-practices
Production: /api/docs/guides/production-best-practices
Products: /commerce/specs/api/products
Products: /commerce/specs/file-upload/products
Profiles: /codex/permissions
Programmatic tool calling: /api/docs/guides/tools-programmatic-tool-calling
Projects and access: /api/docs/guides/terraform/projects-and-access
Projects and chats: /codex/projects
Promotions: /commerce/specs/api/promotions
Prompt caching: /api/docs/guides/prompt-caching
Prompt engineering: /api/docs/guides/prompt-engineering
Prompt generation: /api/docs/guides/prompt-generation
Prompt optimizer: /api/docs/guides/prompt-optimizer
Prompting: /codex/prompting
Propose security hardening: /codex/security/plugin/security-hardening
Quickstart: /ads/api-quickstart
Quickstart: /api/docs/guides/agents/quickstart
Quickstart: /api/docs/quickstart
Quickstart: /codex/quickstart
Quickstart: /codex/security/cli
Quickstart: /codex/security/plugin
Quickstart: /plugins/quickstart
RFT use cases: /api/docs/guides/rft-use-cases
Rate limit guide: /api/docs/guides/rate-limits
Rate limits and spend: /api/docs/guides/terraform/rate-limits-and-spend
Rate limits: /api/docs/guides/rate-limits
Realtime prompting guide: /api/docs/guides/realtime-models-prompting
Realtime transcription: /api/docs/guides/realtime-transcription
Realtime with tools: /api/docs/guides/realtime-mcp
Reasoning best practices: /api/docs/guides/reasoning-best-practices
Reasoning models: /api/docs/guides/reasoning
Record & Replay: /codex/extend/record-and-replay
Red teaming: /api/docs/guides/red-teaming
Reddit: https://www.reddit.com/r/OpenAI/
Reference: /codex/security/cli/reference
Reinforcement fine-tuning: /api/docs/guides/reinforcement-fine-tuning
Remote connections: /codex/remote-connections
Remote: /codex/remote
Resources: /codex/resources
Resources: /learn
Responses API: /api/docs/guides/migrate-to-responses
Restaurant reservation spec: /plugins/guides/restaurant-reservation-conversion-spec
Results and state: /api/docs/guides/agents/results
Retrieval: /api/docs/guides/retrieval
Review code changes: /codex/security/plugin/code-changes
Roles and workspace permissions: /codex/enterprise/roles-and-workspace-permissions
Rules: /codex/agent-configuration/rules
Run a deep scan: /codex/security/plugin/deep-scans
Run a security scan: /codex/security/plugin/scans
Run bulk scans: /codex/security/cli/bulk-scans
Run scans in CI: /codex/security/cli/ci
Running agents: /api/docs/guides/agents/running-agents
SIP: /api/docs/guides/realtime-sip
SPIFFE: /api/docs/guides/workload-identity-federation/spiffe
Safety best practices: /api/docs/guides/safety-best-practices
Safety checks: /api/docs/guides/safety-checks
Safety in building agents: /api/docs/guides/agent-builder-safety
Sample Config: /codex/config-file/config-sample
Sandbox agents: /api/docs/guides/agents/sandboxes
Sandboxing: /codex/sandboxing
Scale Tier: https://openai.com/api-scale-tier/
Scaling: /learn/scaling
Scheduled tasks: /codex/automations
Secure MCP Tunnel: /api/docs/guides/secure-mcp-tunnels
Security & Privacy: /plugins/guides/security-privacy
Security Review: /codex/security/security-review
Service accounts: /api/docs/guides/terraform/service-accounts
Settings page: https://platform.openai.com/settings/organization/general
Settings: /codex/reference/settings
Setup: /codex/security/setup
Shell: /api/docs/guides/tools-shell
Showcase Demo apps to get inspired: /showcase
Showcase: /showcase
Showcase: https://developers.openai.com/showcase
Sites: /codex/sites
Skill controls: /codex/enterprise/skills
Skills & Plugins: /codex/skills-and-plugins
Skills: /api/docs/guides/tools-skills
Skills: /plugins/concepts/skills
Slack: /codex/third-party/slack
Slash commands: /codex/reference/slash-commands
Speech generation: /api/docs/guides/text-to-speech
Speed: /codex/agent-configuration/speed
Spend limits: /api/docs/guides/spend-limits
Streaming: /api/docs/guides/streaming-responses
Structured output: /api/docs/guides/structured-outputs
Subagents: /codex/agent-configuration/subagents
Submission error reference: /plugins/deploy/submission-errors
Submit and publish: /plugins/deploy/submission
Supervised fine-tuning: /api/docs/guides/supervised-fine-tuning
Supported Events: /ads/supported-events
Supported countries: /api/docs/supported-countries
Team page: https://platform.openai.com/settings/organization/people
Terms and policies: https://openai.com/policies
Terraform provider: /api/docs/guides/terraform
Text generation: /api/docs/guides/text
Text: /cookbook/topic/text
Tool search: /api/docs/guides/tools-tool-search
Tools: /api/docs/assistants/tools
Tools: /api/docs/guides/tools
Tools: /learn/tools
Transcription: /api/docs/guides/transcription
Triage a backlog: /codex/security/plugin/triage-backlog
Trigger workspace agent runs: /workspace-agents/trigger-runs
Troubleshooting: /codex/reference/troubleshooting
Troubleshooting: /plugins/deploy/troubleshooting
Try ChatGPT: https://chatgpt.com/
TypeScript SDK: /codex/security/sdk
UI guidelines: /plugins/concepts/ui-guidelines
Under 18 API Guidance: /api/docs/guides/safety-checks/under-18-api-guidance
Use ChatGPT: /codex/use-chatgpt
Use cases Example workflows and tasks teams can take on with ChatGPT or Codex: https://learn.chatgpt.com/use-cases
Use cases: /codex/use-cases
Use cases: https://learn.chatgpt.com/use-cases
Use the Security workbench: /codex/security/plugin/workbench
Using GPT-5.6: /api/docs/guides/latest-model
Video generation: /api/docs/guides/video-generation
Video generation: /learn/videogen
Videos: /codex/videos
Videos: /learn/videos
Vision fine-tuning: /api/docs/guides/vision-fine-tuning
Visualizations: /codex/visualizations
Voice & Audio: /api/docs/guides/realtime
Voice activity detection: /api/docs/guides/realtime-vad
Voice agents: /api/docs/guides/voice-agents
Voice: /codex/features/voice
WSL: /codex/windows/wsl
Web search: /api/docs/guides/tools-web-search
Web search: /codex/web-search
WebRTC: /api/docs/guides/realtime-webrtc
WebSocket mode: /api/docs/guides/websocket-mode
WebSocket: /api/docs/guides/realtime-websocket
Webhooks and server-side controls: /api/docs/guides/realtime-server-controls
Webhooks: /api/docs/guides/webhooks
What's new: /codex/whats-new
Widgets: /api/docs/guides/chatkit-widgets
Windows app deployment: /codex/enterprise/windows-deployment
Windows sandbox: /codex/windows/windows-sandbox
Work with files: /codex/artifacts-viewer
Working with evals: /api/docs/guides/evals
Workload identity federation: /api/docs/guides/workload-identity-federation
Workspace Agents Trigger published ChatGPT workspace agents: /workspace-agents
Workspace analytics: /codex/enterprise/workspace-analytics
Workspace model availability: /codex/enterprise/workspace-model-availability
Write vulnerability reports: /codex/security/plugin/vulnerability-reports
X.509 certificates (beta): /api/docs/guides/workload-identity-federation/x509
X: https://x.com/OpenAIDevs
Your data: /api/docs/guides/your-data
add credits in your billing settings: https://platform.openai.com/settings/organization/billing
approved usage limit: https://platform.openai.com/settings/organization/limits
best practices guide: https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
best practices: https://help.openai.com/en/articles/6891753-rate-limit-advice
check our system status page: https://status.openai.com/
contact our support team via chat: https://help.openai.com/en/
contact support: https://help.openai.com/
documentation: /api/docs/api-reference/
generate a new one: https://platform.openai.com/settings/organization/api-keys
gpt-oss: /cookbook/topic/gpt-oss
gpt-oss: /learn/gpt-oss
invite you to an organization: https://platform.openai.com/settings/organization/people
llms.txt: /llms.txt
official Python library: /api/docs/libraries#install-an-official-sdk
organization limit settings: https://platform.openai.com/settings/organization/limits
organization spend limit: https://platform.openai.com/settings/organization/limits
post in our Community Forum: https://community.openai.com
project settings: https://platform.openai.com/settings/
rate limit guide: /api/docs/guides/rate-limits
spend limit: /api/docs/guides/spend-limits
status page: https://status.openai.com/
the Responses API WebSocket mode: /api/docs/guides/websocket-mode
this page: /api/docs/supported-countries
usage limit: /api/docs/guides/rate-limits#usage-tiers
your account settings: https://platform.openai.com/settings/organization/api-keys

[content]
Error codes | OpenAI API
For the complete documentation index, see
llms.txt
. Markdown versions of documentation pages are available by appending
.md
to the page URL.
ChatGPT
Home
API
Codex
Docs
Guides, concepts, and product docs for Codex
Use cases
Example workflows and tasks teams can take on with ChatGPT or Codex
Docs
Use cases
Resources
ChatGPT
Plugins
Extend ChatGPT and Codex
Workspace Agents
Trigger published ChatGPT workspace agents
Commerce
Build commerce flows in ChatGPT
Ads
Publish and measure ads in ChatGPT
Resources
Showcase
Demo apps to get inspired
Blog
Learnings and experiences from developers
Cookbook
Notebook examples for building with OpenAI models
Learn
Docs, videos, and demo apps for building with OpenAI
Community
Programs, meetups, and support for builders
Start searching
API Dashboard
Try ChatGPT
Overview
Models
Agents
Tools
Voice & Audio
Production
API reference
Search the API docs
Search docs
Suggested
responses create
reasoning_effort
realtime
prompt caching
Primary navigation
API
Codex
ChatGPT
Docs
Use cases
Resources
Resources
Search docs
Suggested
responses create
reasoning_effort
realtime
prompt caching
Overview
Models
Agents
Tools
Voice & Audio
Production
API reference
Overview
Models
Agents
Tools
Voice & Audio
Production
API reference
Docs section
Production
Home
Get started
Quickstart
Using GPT-5.6
Key concepts
Core concepts
Responses API
Conversation state
Background mode
Streaming
WebSocket mode
Multi-agent
Webhooks
File inputs
Compaction
Counting tokens
SDKs and CLI
OpenAI SDK
OpenAI CLI
Resources
Changelog
Deprecations
Supported countries
OpenAI Crawlers
Terms and policies
Legacy APIs
Agent Builder
Overview
Migration guide
Node reference
Safety in building agents
Evals
Getting started
Working with evals
Prompt optimizer
External models
Best practices
Graders
Fine-tuning
Optimization cycle
Supervised fine-tuning
Vision fine-tuning
Direct preference optimization
Reinforcement fine-tuning
RFT use cases
Best practices
Assistants API
Migration guide
Deep dive
Tools
Model catalog
Choose a model
Pricing
Model selection
Text and code
Text generation
Code generation
Structured output
Prompting
Overview
Prompt engineering
Citation formatting
Migration guide
Prompt generation
Frontend prompting
Reasoning
Reasoning models
Reasoning best practices
Images and video
Images and vision
Image generation
Video generation
Realtime and audio
Audio and speech
Overview
Voice agents
Specialized models
Deep research
Embeddings
Moderation
Overview
Agents SDK
Quickstart
Agent definitions
Models and providers
Running agents
Sandbox agents
Orchestration
Guardrails
Results and state
Integrations and observability
Evaluate agent workflows
ChatKit
Overview
Customize
Widgets
Actions
Advanced integrations
Overview
Function calling
Search and retrieval
Web search
File search
Retrieval
Connect tools and data
MCP and Connectors
Secure MCP Tunnel
Build tool workflows
Skills
Tool search
Programmatic tool calling
Computer and code
Shell
Computer use
Apply Patch
Local shell
Code interpreter
Media
Image generation
Overview
Get started
Voice agents
Live translation
Realtime prompting guide
Audio
Audio and speech
Transcription
File transcription
Realtime transcription
Speech generation
Connection methods
WebRTC
WebSocket
SIP
Sessions and operations
Managing conversations
Voice activity detection
Realtime with tools
Webhooks and server-side controls
Managing costs
Go live
Production best practices
Deployment checklist
Performance and quality
Latency optimization
Predicted Outputs
Fast mode
Accuracy optimization
Cost and throughput
Cost optimization
Prompt caching
Batch
Flex processing
Safety and governance
Safety best practices
Red teaming
Safety checks
Cybersecurity checks
Under 18 API Guidance
Content provenance
Your data
Permissions
Infrastructure and access
Terraform provider
Overview
Projects and access
Service accounts
Rate limits and spend
Model, tool, and data controls
Import and reconciliation
Private Link
Workload identity federation
X.509 certificates (beta)
Kubernetes
AWS
Microsoft Azure
Google Cloud
Oracle Cloud Infrastructure
GitHub Actions
SPIFFE
IP egress ranges
Amazon Bedrock
Operations
Rate limits
Spend limits
Admin APIs
Error codes
Docs
Use cases
Docs
Use cases
Docs section
Docs
Plugins
Workspace Agents
Commerce
Ads
Plugins
Workspace Agents
Commerce
Ads
Docs section
Select...
Home
Quickstart
Core concepts
Plugin architecture
Skills
MCP server
Plan
Brainstorm use cases
Define tools
Build
Build an MCP server
Add UI to your MCP server (optional)
Authenticate users
Build skills
Package your plugin
Examples
Test and publish
Connect and test your plugin
Submit and publish
Submission error reference
Conversion specs
Restaurant reservation spec
Get Quote spec
Product checkout spec
Guides
UI guidelines
Optimize Metadata
Security & Privacy
Troubleshooting
Resources
Changelog
Plugin guidelines
MCP server review requirements
Plugin UI reference
Checkout API reference
Home
Get started
Trigger workspace agent runs
Authenticate with Workspace Agent access tokens
Home
Guides
Get started
Best practices
File Upload
Overview
Products
API
Overview
Feeds
Products
Promotions
Ads Overview
Measurement
Measurement Pixel
Multiple Pixels (Advanced)
Image Tag
Conversions API
Supported Events
Advertiser API
Overview
API Partner Setup
Quickstart
Bulk API
Product Feeds
Campaign Targeting
Conversion-Optimized Campaigns
API Reference
Authentication
Ad Account
Campaigns
Ad Groups
Ads
Insights
Files
Conversion Setup
Overview
Features
Configuration
Developers
Security
Administration
Use Cases
Resources
Overview
Features
Configuration
Developers
Security
Administration
Use Cases
Resources
Docs section
Overview
Home
Get started
Quickstart
Use ChatGPT
Get started with Work
Import from another agent
Foundations
Prompting
Personalize ChatGPT
Skills & Plugins
Permissions
Explore
What's new
Models
Pricing
Glossary
Available on
ChatGPT desktop app
Remote
ChatGPT on the web
Codex CLI
Codex IDE extension
Codex cloud
Releases
Changelog
Feature Maturity
Open Source
Overview
Workflows
Projects and chats
Sites
Visualizations
Scheduled tasks
Long-running work
Notifications
Pets
Codex Micro
Capabilities
Browser
Computer use
Voice
Plugins
Web search
Image generation
Image inputs
Appshots
Chrome extension
Work with files
Reference
Commands
Slash commands
Settings
Troubleshooting
Overview
Customization
Overview
Memories
Chronicle
Config file
Config Basics
Advanced Config
Config Reference
Environment Variables
Sample Config
Agent configuration
AGENTS.md
Subagents
Speed
Rules
Extend ChatGPT and Codex
Record & Replay
MCP
Windows
Desktop app
Windows sandbox
WSL
Overview
Development workflows
Code review
Integrated terminal
Extend and automate
Build skills
Build plugins
Hooks
Environments
Modes
Local environments
Cloud environment
Git worktrees
Build with Codex
Codex SDK
App Server
MCP Server
GitHub Action
Non-interactive mode
Third-party integrations
GitHub
Slack
Linear
Reference
CLI customization
Developer commands
Developer settings
Overview
Permissions
Profiles
Sandboxing
Auto-review
Agent approvals & security
Internet access
Codex Security
Overview
Codex Security plugin
Quickstart
Run a security scan
Run a deep scan
Review code changes
Use the Security workbench
Triage a backlog
Fix findings
Propose security hardening
Write vulnerability reports
Export and track findings
Changelog
Codex Security CLI
Quickstart
Run bulk scans
Run scans in CI
Reference
FAQ
TypeScript SDK
Codex Security cloud
Setup
Security Review
Improving the threat model
FAQ
Safety
Cyber Safety
Overview
Getting started
Admin rollout guide
ChatGPT Work admin FAQ
Identity and authentication
Authentication overview
Access tokens
Workspace access, policy, and models
Groups and provisioning
Roles and workspace permissions
Managed configuration
Prisma AIRS
HIPAA configuration
Workspace model availability
Plugin and connector controls
Plugin controls
Skill controls
Usage, governance, and compliance
Governance
Workspace analytics
Analytics API
Compliance API and audit events
Deployment and model providers
Manage app updates
Windows app deployment
Remote connections
Amazon Bedrock
Explore use cases
Collections
Home
Videos
Showcase
OpenAI Academy
Online trainings
Community
Codex Ambassadors
Codex for Students
Codex for Open Source
Meetups
Blog
Company blog
Developer blog
Explore use cases
Collections
Home
Videos
Showcase
OpenAI Academy
Online trainings
Community
Codex Ambassadors
Codex for Students
Codex for Open Source
Meetups
Blog
Company blog
Developer blog
Showcase
Blog
Cookbook
Learn
Community
Showcase
Blog
Cookbook
Learn
Community
Docs section
Select...
All posts
Recent
Custom Code Review rules for Codex
Mastering remote engineering work from your phone
Making private MCP servers reachable without making them public
How Perplexity Brought Voice Search to Millions Using the Realtime API
Designing delightful frontends with GPT-5.4
Topics
General
API
Apps SDK
Audio
Codex
Home
Topics
Agents
Evals
Multimodal
Text
Guardrails
Optimization
ChatGPT
Codex
gpt-oss
Contribute
Cookbook on GitHub
Home
OpenAI Developers plugin
Docs MCP
Categories
Demo apps
Videos
Topics
Agents
Audio & Voice
Computer Use
Codex
Evals
gpt-oss
Fine-tuning
Image generation
Scaling
Tools
Video generation
Community
Programs
Codex Ambassadors
Codex for Students
Codex for Open Source
OpenAI for Startups
Events
Meetups
Spaces
Developer Forum
Discord
Reddit
X
API Dashboard
Try ChatGPT
Go live
Production best practices
Deployment checklist
Performance and quality
Latency optimization
Predicted Outputs
Fast mode
Accuracy optimization
Cost and throughput
Cost optimization
Prompt caching
Batch
Flex processing
Safety and governance
Safety best practices
Red teaming
Safety checks
Cybersecurity checks
Under 18 API Guidance
Content provenance
Your data
Permissions
Infrastructure and access
Terraform provider
Overview
Projects and access
Service accounts
Rate limits and spend
Model, tool, and data controls
Import and reconciliation
Private Link
Workload identity federation
X.509 certificates (beta)
Kubernetes
AWS
Microsoft Azure
Google Cloud
Oracle Cloud Infrastructure
GitHub Actions
SPIFFE
IP egress ranges
Amazon Bedrock
Operations
Rate limits
Spend limits
Admin APIs
Error codes
Copy Page
Error codes
Explore API error codes and solutions.
Copy Page
This guide includes an overview on error codes you might see from both the
API
and our
official Python library
. Each error code mentioned in the overview has a dedicated section with further guidance.
API errors
Code
Overview
401 - Invalid Authentication
Cause:
Invalid Authentication
Solution:
Ensure the correct
API key
and requesting organization are being used.
401 - Incorrect API key provided
Cause:
The requesting API key is not correct.
Solution:
Ensure the API key used is correct, clear your browser cache, or
generate a new one
.
401 - You must be a member of an organization to use the API
Cause:
Your account is not part of an organization.
Solution:
Contact us to get added to a new organization or ask your organization manager to
invite you to an organization
.
401 - IP not authorized
Cause:
Your request IP does not match the configured IP allowlist for your project or organization.
Solution:
Send the request from the correct IP, or update your
IP allowlist settings
.
403 - Country, region, or territory not supported
Cause:
You are accessing the API from an unsupported country, region, or territory.
Solution:
Please see
this page
for more information.
429 - Credit balance exhausted
Code:
credit_balance_exhausted
Cause:
Your organization has no prepaid credits remaining.
Solution:
Add credits
to continue using the API.
429 - Rate limit reached for requests
Cause:
You are sending requests too quickly.
Solution:
Pace your requests and follow the
Retry-After
header when it’s present. Read the
Rate limit guide
.
429 - Organization spend limit reached
Code:
organization_spend_limit_exceeded
Cause:
Your organization reached its enforced spend limit.
Solution:
Increase or remove your
organization spend limit
.
429 - Project spend limit reached
Code:
project_spend_limit_exceeded
Cause:
Your project reached its enforced spend limit.
Solution:
Increase or remove the spend limit in your
project settings
.
429 - Organization usage limit reached
Code:
organization_usage_limit_exceeded
Cause:
Your organization reached its OpenAI-assigned usage limit.
Solution:
Request a higher
approved usage limit
or
contact support
.
500 - The server had an error while processing your request
Cause:
Issue on our servers.
Solution:
Retry your request after a brief wait and contact us if the issue persists. Check the
status page
.
503 - The engine is currently overloaded, please try again later
Cause:
Our servers are experiencing high traffic.
Solution:
Please retry your requests after a brief wait.
503 - Slow Down
Cause:
A sudden increase in your request rate is impacting service reliability.
Solution:
Please reduce your request rate to its original level, maintain a consistent rate for at least 15 minutes, and then gradually increase it.
For billing-related errors, inspect
error.code
to identify the specific cause. The broader
error.type
can still be
insufficient_quota
.
Retrying billing, spend, or quota errors won’t restore API access. Update the relevant credits or limits before sending another request.
WebSocket mode errors
If you are using
the Responses API WebSocket mode
, you may see these additional errors:
previous_response_not_found
: The
previous_response_id
cannot be resolved from available state. Retry with full input context and
previous_response_id
set to
null
.
websocket_connection_limit_reached
: The connection hit the 60-minute limit. Open a new WebSocket connection and continue.
401 - Invalid Authentication
This error message indicates that your authentication credentials are invalid. This could happen for several reasons, such as:
You are using a revoked API key.
You are using a different API key than the one assigned to the requesting organization or project.
You are using an API key that does not have the required permissions for the endpoint you are calling.
To resolve this error, please follow these steps:
Check that you are using the correct API key and organization ID in your request header. You can find your API key and organization ID in
your account settings
or your can find specific project related keys under
General settings
by selecting the desired project.
If you are unsure whether your API key is valid, you can
generate a new one
. Make sure to replace your old API key with the new one in your requests and follow our
best practices guide
.
401 - Incorrect API key provided
This error message indicates that the API key you are using in your request is not correct. This could happen for several reasons, such as:
There is a typo or an extra space in your API key.
You are using an API key that belongs to a different organization or project.
You are using an API key that has been deleted or deactivated.
An old, revoked API key might be cached locally.
To resolve this error, please follow these steps:
Try clearing your browser’s cache and cookies, then try again.
Check that you are using the correct API key in your request header.
If you are unsure whether your API key is correct, you can
generate a new one
. Make sure to replace your old API key in your codebase and follow our
best practices guide
.
401 - You must be a member of an organization to use the API
This error message indicates that your account is not part of an organization. This could happen for several reasons, such as:
You have left or been removed from your previous organization.
You have left or been removed from your previous project.
Your organization has been deleted.
To resolve this error, please follow these steps:
If you have left or been removed from your previous organization, you can either request a new organization or get invited to an existing one.
To request a new organization, reach out to us via help.openai.com
Existing organization owners can invite you to join their organization via the
Team page
or can create a new project from the
Settings page
.
If you have left or been removed from a previous project, you can ask your organization or project owner to add you to it, or create a new one.
429 - Credit balance exhausted
The
credit_balance_exhausted
error indicates that your organization’s prepaid credit balance is depleted.
To restore API access,
add credits in your billing settings
.
429 - Rate limit reached for requests
This error message indicates that you have hit your assigned rate limit for the API. This means that you have submitted too many tokens or requests in a short period of time and have exceeded the number of requests allowed. This could happen for several reasons, such as:
You are using a loop or a script that makes frequent or concurrent requests.
You are sharing your API key with other users or applications.
You are using a free plan that has a low rate limit.
You have reached the defined limit on your project
To resolve this error, please follow these steps:
Pace your requests and avoid making unnecessary or redundant calls.
If a
Retry-After
header is present, wait at least as long as it specifies before trying again. If it’s missing, use exponential backoff with jitter and limit the number of retries. Each official SDK already honors this header for eligible retries. Read more in our
rate limit guide
.
If you are sharing your organization with other users, note that limits are applied per organization and not per user. It is worth checking on the usage of the rest of your team as this will contribute to the limit.
If you are using a free or low-tier plan, consider upgrading to a pay-as-you-go plan that offers a higher rate limit. You can compare the restrictions of each plan in our
rate limit guide
.
Reach out to your organization owner to increase the rate limits on your project
429 - Organization spend limit reached
The
organization_spend_limit_exceeded
error indicates that your organization reached its enforced monthly
spend limit
. The limit applies to API traffic across all projects in the organization.
To restore API access, increase or remove the limit in your
organization limit settings
. Otherwise, access resumes after the monthly limit resets.
429 - Project spend limit reached
The
project_spend_limit_exceeded
error indicates that your project reached its enforced monthly
spend limit
. Other projects can continue unless their own limit or the organization limit is also reached.
To restore API access, increase or remove the limit in your
project settings
. Otherwise, access resumes after the monthly limit resets.
429 - Organization usage limit reached
The
organization_usage_limit_exceeded
error indicates that your organization reached its OpenAI-assigned monthly
usage limit
. This limit is separate from organization and project spend limits that you configure.
To restore API access, request a higher
approved usage limit
or
contact support
.
503 - The engine is currently overloaded, please try again later
This error message indicates that our servers are experiencing high traffic and are unable to process your request at the moment. This could happen for several reasons, such as:
There is a sudden spike or surge in demand for our services.
There is scheduled or unscheduled maintenance or update on our servers.
There is an unexpected or unavoidable outage or incident on our servers.
To resolve this error, please follow these steps:
Retry your request after a brief wait. We recommend using an exponential backoff strategy or a retry logic that respects the response headers and the rate limit. You can read more about our rate limit
best practices
.
Check our
status page
for any updates or announcements regarding our services and servers.
If you are still getting this error after a reasonable amount of time, please contact us for further assistance. We apologize for any inconvenience and appreciate your patience and understanding.
503 - Slow Down
This error can occur with Pay-As-You-Go models, which are shared across all OpenAI users. It indicates that your traffic has significantly increased, overloading the model and triggering temporary throttling to maintain service stability.
To resolve this error, please follow these steps:
Reduce your request rate to its original level, keep it stable for at least 15 minutes, and then gradually ramp it up.
Maintain a consistent traffic pattern to minimize the likelihood of throttling. You should rarely encounter this error if your request volume remains steady.
Consider upgrading to the
Scale Tier
for guaranteed capacity and performance, ensuring more reliable access during peak demand periods.
Python library error types
Type
Overview
APIConnectionError
Cause:
Issue connecting to our services.
Solution:
Check your network settings, proxy configuration, SSL certificates, or firewall rules.
APITimeoutError
Cause:
Request timed out.
Solution:
Retry your request after a brief wait and contact us if the issue persists.
AuthenticationError
Cause:
Your API key or token was invalid, expired, or revoked.
Solution:
Check your API key or token and make sure it is correct and active. You may need to generate a new one from your account dashboard.
BadRequestError
Cause:
Your request was malformed or missing some required parameters, such as a token or an input.
Solution:
The error message should advise you on the specific error made. Check the
documentation
for the specific API method you are calling and make sure you are sending valid and complete parameters. You may also need to check the encoding, format, or size of your request data.
ConflictError
Cause:
The resource was updated by another request.
Solution:
Try to update the resource again and ensure no other requests are trying to update it.
InternalServerError
Cause:
Issue on our side.
Solution:
Retry your request after a brief wait and contact us if the issue persists.
NotFoundError
Cause:
Requested resource does not exist.
Solution:
Ensure you are the correct resource identifier.
PermissionDeniedError
Cause:
You don’t have access to the requested resource.
Solution:
Ensure you are using the correct API key, organization ID, and resource ID.
RateLimitError
Cause:
You have hit your assigned rate limit.
Solution:
Pace your requests and follow
Retry-After
when it’s present. Each official SDK already honors this header for eligible retries. Read more in our
Rate limit guide
.
UnprocessableEntityError
Cause:
Unable to process the request despite the format being correct.
Solution:
Please try the request again.
APIConnectionError
An
APIConnectionError
indicates that your request could not reach our servers or establish a secure connection. This could be due to a network issue, a proxy configuration, an SSL certificate, or a firewall rule.
If you encounter an
APIConnectionError
, please try the following steps:
Check your network settings and make sure you have a stable and fast internet connection. You may need to switch to a different network, use a wired connection, or reduce the number of devices or applications using your bandwidth.
Check your proxy configuration and make sure it is compatible with our services. You may need to update your proxy settings, use a different proxy, or bypass the proxy altogether.
Check your SSL certificates and make sure they are valid and up-to-date. You may need to install or renew your certificates, use a different certificate authority, or disable SSL verification.
Check your firewall rules and make sure they are not blocking or filtering our services. You may need to modify your firewall settings.
If appropriate, check that your container has the correct permissions to send and receive traffic.
If the issue persists, check out our persistent errors next steps section.
APITimeoutError
A
APITimeoutError
error indicates that your request took too long to complete and our server closed the connection. This could be due to a network issue, a heavy load on our services, or a complex request that requires more processing time.
If you encounter a
APITimeoutError
error, please try the following steps:
Wait a few seconds and retry your request. Sometimes, the network congestion or the load on our services may be reduced and your request may succeed on the second attempt.
Check your network settings and make sure you have a stable and fast internet connection. You may need to switch to a different network, use a wired connection, or reduce the number of devices or applications using your bandwidth.
If the issue persists, check out our persistent errors next steps section.
AuthenticationError
An
AuthenticationError
indicates that your API key or token was invalid, expired, or revoked. This could be due to a typo, a formatting error, or a security breach.
If you encounter an
AuthenticationError
, please try the following steps:
Check your API key or token and make sure it is correct and active. You may need to generate a new key from the API Key dashboard, ensure there are no extra spaces or characters, or use a different key or token if you have multiple ones.
Ensure that you have followed the correct formatting.
BadRequestError
An
BadRequestError
(formerly
InvalidRequestError
) indicates that your request was malformed or missing some required parameters, such as a token or an input. This could be due to a typo, a formatting error, or a logic error in your code.
If you encounter an
BadRequestError
, please try the following steps:
Read the error message carefully and identify the specific error made. The error message should advise you on what parameter was invalid or missing, and what value or format was expected.
Check the
API Reference
for the specific API method you were calling and make sure you are sending valid and complete parameters. You may need to review the parameter names, types, values, and formats, and ensure they match the documentation.
Check the encoding, format, or size of your request data and make sure they are compatible with our services. You may need to encode your data in UTF-8, format your data in JSON, or compress your data if it is too large.
Test your request using a tool like Postman or curl and make sure it works as expected. You may need to debug your code and fix any errors or inconsistencies in your request logic.
If the issue persists, check out our persistent errors next steps section.
InternalServerError
An
InternalServerError
indicates that something went wrong on our side when processing your request. This could be due to a temporary error, a bug, or a system outage.
We apologize for any inconvenience and we are working hard to resolve any issues as soon as possible. You can
check our system status page
for more information.
If you encounter an
InternalServerError
, please try the following steps:
Wait a few seconds and retry your request. Sometimes, the issue may be resolved quickly and your request may succeed on the second attempt.
Check our status page for any ongoing incidents or maintenance that may affect our services. If there is an active incident, please follow the updates and wait until it is resolved before retrying your request.
If the issue persists, check out our Persistent errors next steps section.
Our support team will investigate the issue and get back to you as soon as possible. Note that our support queue times may be long due to high demand. You can also
post in our Community Forum
but be sure to omit any sensitive information.
RateLimitError
A
RateLimitError
indicates that you have hit your assigned rate limit. This means that you have sent too many tokens or requests in a given period of time, and our services have temporarily blocked you from sending more.
We impose rate limits to ensure fair and efficient use of our resources and to prevent abuse or overload of our services.
If you encounter a
RateLimitError
, please try the following steps:
Send fewer tokens or requests or slow down. You may need to reduce the frequency or volume of your requests, batch your tokens, or use exponential backoff when
Retry-After
isn’t present. You can read our
Rate limit guide
for more details.
When
Retry-After
is present, wait at least as long as it specifies before retrying. The official Python library already honors this header for eligible retries.
You can also check your API usage statistics from your account dashboard.
Persistent errors
If the issue persists,
contact our support team via chat
and provide them with the following information:
The model you were using
The error message and code you received
The request data and headers you sent
The timestamp and timezone of your request
Any other relevant details that may help us diagnose the issue
Our support team will investigate the issue and get back to you as soon as possible. Note that our support queue times may be long due to high demand. You can also
post in our Community Forum
but be sure to omit any sensitive information.
Handling errors
We advise you to programmatically handle errors returned by the API. To do so, you may want to use a code snippet like below:
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import
openai
from
openai
import
OpenAI
client
=
OpenAI()
try
:
response
=
client.responses.create(
model
=
"gpt-5.6"
,
input
=
"Hello world"
)
except
openai.APIConnectionError
as
e:
print
(
f
"Failed to connect to OpenAI API:
{
e
}
"
)
except
openai.RateLimitError
as
e:
print
(
f
"OpenAI API request exceeded rate limit:
{
e
}
"
)
except
openai.APIError
as
e:
print
(
f
"OpenAI API returned an API Error:
{
e
}
"
)
else
:
print
(response.output_text)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main
import (
"context"
"errors"
"fmt"
"github.com/openai/openai-go/v3"
"github.com/openai/openai-go/v3/responses"
)
func main() {
client := openai.NewClient()
response, err := client.Responses.New(context.Background(), responses.ResponseNewParams{
Model: "gpt-5.6",
Input: responses.ResponseNewParamsInputUnion{OfString: openai.String("Hello world")},
})
if err != nil {
var apiError *openai.Error
if errors.As(err, &apiError) {
fmt.Println("OpenAI API returned an API error:", apiError)
return
}
fmt.Println("Failed to connect to OpenAI API:", err)
return
}
fmt.Println(response.OutputText())
}
Ask AI
Docs agent
Loading docs agent...
