{"record":{"id":"a249ebd0fe152a91","repo":"BerriAI/litellm","slug":"openai-client-is-not-an-instance-of-asyncopenai-m-a249eb","errorCode":null,"errorMessage":"OpenAI client is not an instance of AsyncOpenAI. Make sure you passed an AsyncOpenAI client.","messagePattern":"OpenAI client is not an instance of AsyncOpenAI\\. Make sure you passed an AsyncOpenAI client\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/openai/fine_tuning/handler.py","lineNumber":132,"sourceCode":"    ) -> LiteLLMFineTuningJob | Coroutine[Any, Any, LiteLLMFineTuningJob]:\n        openai_client: Final[OpenAI | AsyncOpenAI | AzureOpenAI | AsyncAzureOpenAI | None] = self.get_openai_client(\n            api_key=api_key,\n            api_base=api_base,\n            timeout=timeout,\n            max_retries=max_retries,\n            organization=organization,\n            client=client,\n            _is_async=_is_async,\n            api_version=api_version,\n        )\n        if openai_client is None:\n            raise ValueError(\n                \"OpenAI client is not initialized. Make sure api_key is passed or OPENAI_API_KEY is set in the environment.\"\n            )\n\n        if _is_async is True:\n            if not isinstance(openai_client, (AsyncOpenAI, AsyncAzureOpenAI)):\n                raise ValueError(\n                    \"OpenAI client is not an instance of AsyncOpenAI. Make sure you passed an AsyncOpenAI client.\"\n                )\n            return self.acreate_fine_tuning_job(\n                create_fine_tuning_job_data=create_fine_tuning_job_data,\n                openai_client=openai_client,\n            )\n        verbose_logger.debug(\"creating fine tuning job, args= %s\", create_fine_tuning_job_data)\n        response: Final = cast(OpenAI, openai_client).fine_tuning.jobs.create(**create_fine_tuning_job_data)\n        return _litellm_fine_tuning_job_from_response(response)\n\n    async def acancel_fine_tuning_job(\n        self,\n        fine_tuning_job_id: str,\n        openai_client: AsyncOpenAI | AsyncAzureOpenAI,\n    ) -> LiteLLMFineTuningJob:\n        response: Final = await openai_client.fine_tuning.jobs.cancel(fine_tuning_job_id=fine_tuning_job_id)\n        return _litellm_fine_tuning_job_from_response(response)\n","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/openai/fine_tuning/handler.py#L114-L150","documentation":"Error \"OpenAI client is not an instance of AsyncOpenAI. Make sure you passed an AsyncOpenAI client.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/openai/fine_tuning/handler.py:132 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an AsyncOpenAI client instance."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}