Cette page est affichée en anglais. Une traduction française est en cours.
SkillsMay 11, 2026·2 min de lecture

openai-python — Official OpenAI Python SDK

Call the OpenAI REST API from Python 3.9+ with typed request/response models and sync/async clients. Use it as a core SDK for agents and app backends.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Asset
Commande d'installation directe
npx -y tokrepo@latest install c0cc4d66-d935-43f1-a394-8222c4c15c31 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

Call the OpenAI REST API from Python 3.9+ with typed request/response models and sync/async clients. Use it as a core SDK for agents and app backends.

  • Best for: Python developers building LLM apps who want typed clients and a stable upgrade path
  • Works with: Python 3.9+, OpenAI API, httpx-powered sync/async clients
  • Setup time: 6 minutes

Quantitative Notes

  • Setup time ~6 minutes (pip install + set API key + one request)
  • GitHub stars + forks (verified): see Source & Thanks
  • Python requirement: 3.9+ (repo README)

Practical Notes

Keep SDK usage behind a thin adapter in your codebase (one module) so upgrades don’t ripple through your app. Centralize timeouts/retries and log request IDs. For agents, restrict tool schemas and validate all model outputs before execution.

Safety note: Never hardcode API keys; use env vars/secret managers and scrub logs.

FAQ

Q: Do I need an API key to import it? A: No. You can import and build clients without a key; you need a key to call the API.

Q: Does it support async? A: Yes. The library provides synchronous and asynchronous clients.

Q: How do I manage rate limits? A: Use retries/backoff, batch where possible, and log request IDs for debugging.


🙏

Source et remerciements

GitHub: https://github.com/openai/openai-python Owner avatar: https://avatars.githubusercontent.com/u/14957082?v=4 License (SPDX): Apache-2.0 GitHub stars (verified via api.github.com/repos/openai/openai-python): 30,747 GitHub forks (verified via api.github.com/repos/openai/openai-python): 4,777

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires