# openai.NotFoundError: Error code 404, python cant find assistant

**URL:** <https://community.openai.com/t/openai-notfounderror-error-code-404-python-cant-find-assistant/544073>\
**Category:** API\
**Tags:** api\
**Created:** [December 5, 2023, 10:01am UTC](https://community.openai.com/t/openai-notfounderror-error-code-404-python-cant-find-assistant/544073 "2023-12-05T10:01:02Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [April 24, 2024, 12:50pm UTC](https://community.openai.com/t/openai-notfounderror-error-code-404-python-cant-find-assistant/544073/7 "2024-04-24T12:50:13Z")

</div>

The first question is if you are using chat.completions or the assistants API. Then, if you have ensured the API key (typically set as environment variable OPENAI\_API\_KEY) is one for the training organization.

Then the model name. The ability to use fine-tuning models in assistants has only just been enabled. The only model that they will allow is `gpt-3.5-turbo-0125`, however.

You can list your fine tune models with this endpoint Python script I wrote up that shows all fine-tunes, and then for you, only those compatible with assistants, using the latest `openai` Python module. That will show you your true model name with created date if it is ready for use.

```python
from typing import List, Optional
from openai import OpenAI
import datetime
import locale

def filter_models(starts_with: Optional[List[str]] = ["gpt", "ft:gpt"], blacklist: Optional[List[str]] = ["instruct"]) -> List[tuple]:
    """
    Fetches and filters model names and creation dates from the OpenAI API based on specified criteria.
    
    Parameters:
        starts_with (List[str]): A list of prefixes to include models that start with any of them.
        blacklist (List[str]): A list of substrings to exclude models that contain any of them.
    
    Returns:
        List[tuple]: A list of filtered model tuples (model name, creation date) that meet the criteria.
    """
    client = OpenAI()
    try:
        model_obj = client.models.list() # API call
    except Exception as err:
        raise ValueError(f"Model listing API call failed: {err}") from None
    
    model_list = sorted([(model.id, model.created) for model in model_obj.data], key=lambda x: x[0])

    def starts_with_any(model_tuple: tuple, starts_with_list: List[str]) -> bool:
        return any(model_tuple[0].startswith(prefix) for prefix in starts_with_list)

    def contains_blacklisted(model_tuple: tuple, blacklist: List[str]) -> bool:
        return any(blacklisted in model_tuple[0] for blacklisted in blacklist)

    filtered_models = [model for model in model_list
                       if starts_with_any(model, starts_with)
                       and not contains_blacklisted(model, blacklist)]

    return filtered_models

locale.setlocale(locale.LC_ALL, '')

default_filtered_models = filter_models(["ft:"])
print("-- All fine-tune models --")
if default_filtered_models:
    print("\n".join(f"{model[0]}, Created: {datetime.datetime.fromtimestamp(model[1]).strftime('%c')}" for model in default_filtered_models))
else:
    print("No models meeting criteria")

default_filtered_models = filter_models(["ft:gpt-3.5-turbo-0125"])
print("-- Fine-tune models compatible with Assistants --")
if default_filtered_models:
    print("\n".join(f"{model[0]}, Created: {datetime.datetime.fromtimestamp(model[1]).strftime('%c')}" for model in default_filtered_models))
else:
    print("No models meeting criteria")

```

Example output:

```plaintext
-- All fine-tune models --
ft:gpt-3.5-turbo-0613:my_org::83govGjy, Created: 9/28/2023 1:37:58 AM
ft:gpt-3.5-turbo-1106:my_org::8IkEWw8r, Created: 11/8/2023 1:18:36 PM
-- Fine-tune models compatible with Assistants --
No models meeting criteria

```

The date should be localized for you.

Happy bot chat!

---

_[View the full topic](https://community.openai.com/t/openai-notfounderror-error-code-404-python-cant-find-assistant/544073)._
