docstr: Construct a new async openai client instance.
  
  This automatically infers the following arguments from their corresponding environment variables if they are not provided:
  - `api_key` from `OPENAI_API_KEY`
  - `organization` from `OPENAI_ORG_ID`
docstr_tok: ["Construct","a","new","async","openai","client","instance",".","This","automatically","infers","the","following","arguments","from","their","corresponding","environment","variables","if","they","are","not","provided",":","-","`","api_key","`","from","`","OPENAI_API_KEY","`","-","`","organization","`","from","`","OPENAI_ORG_ID","`"]
code: def __init__(
      self,
      *,
      api_key: str | None = None,
      organization: str | None = None,
      base_url: str | httpx.URL | None = None,
      timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
      max_retries: int = DEFAULT_MAX_RETRIES,
      default_headers: Mapping[str, str] | None = None,
      default_query: Mapping[str, object] | None = None,
      # Configure a custom httpx client. See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details.
      http_client: httpx.AsyncClient | None = None,
      # Enable or disable schema validation for data returned by the API.
      # When enabled an error APIResponseValidationError is raised
      # if the API responds with invalid data for the expected schema.
      #
      # This parameter may be removed or changed in the future.
      # If you rely on this feature, please open a GitHub issue
      # outlining your use-case to help us decide if it should be
      # part of our public interface in the future.
      _strict_response_validation: bool = False,
  ) -> None:
      """Construct a new async openai client instance.
  
      This automatically infers the following arguments from their corresponding environment variables if they are not provided:
      - `api_key` from `OPENAI_API_KEY`
      - `organization` from `OPENAI_ORG_ID`
      """
      if api_key is None:
          api_key = os.environ.get("OPENAI_API_KEY")
      if api_key is None:
          raise OpenAIError(
              "The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable"
          )
      self.api_key = api_key
  
      if organization is None:
          organization = os.environ.get("OPENAI_ORG_ID")
      self.organization = organization
  
      if base_url is None:
          base_url = os.environ.get("OPENAI_BASE_URL")
      if base_url is None:
          base_url = f"https://api.openai.com/v1"
  
      super().__init__(
          version=__version__,
          base_url=base_url,
          max_retries=max_retries,
          timeout=timeout,
          http_client=http_client,
          custom_headers=default_headers,
          custom_query=default_query,
          _strict_response_validation=_strict_response_validation,
      )
  
      self._default_stream_cls = AsyncStream
  
      self.completions = resources.AsyncCompletions(self)
      self.chat = resources.AsyncChat(self)
      self.embeddings = resources.AsyncEmbeddings(self)
      self.files = resources.AsyncFiles(self)
      self.images = resources.AsyncImages(self)
      self.audio = resources.AsyncAudio(self)
      self.moderations = resources.AsyncModerations(self)
      self.models = resources.AsyncModels(self)
      self.fine_tuning = resources.AsyncFineTuning(self)
      self.beta = resources.AsyncBeta(self)
      self.with_raw_response = AsyncOpenAIWithRawResponse(self)
      self.with_streaming_response = AsyncOpenAIWithStreamedResponse(
          self
      )
  
imports: from __future__ import annotations
  import os
  from typing import Any, Union, Mapping
  from typing_extensions import Self, override
  import httpx
  from .None import resources, _exceptions
  from ._qs import Querystring
  from ._types import NOT_GIVEN, Omit, Timeout, NotGiven, Transport, ProxiesTypes, RequestOptions
  from ._utils import is_given, is_mapping, get_async_library
  from ._version import __version__
  from ._streaming import Stream, AsyncStream
  from ._exceptions import OpenAIError, APIStatusError
  from ._base_client import DEFAULT_MAX_RETRIES, SyncAPIClient, AsyncAPIClient
label_desc: Use image node_id 1 to create a new AsyncOpenAI object from inherited base classes: AsyncAPIClient with example: obj = AsyncOpenAI()