# Error : No API Found

**URL:** <https://discuss.huggingface.co/t/error-no-api-found/146226>\
**Category:** Spaces\
**Created:** [March 18, 2025, 3:19am UTC](https://discuss.huggingface.co/t/error-no-api-found/146226 "2025-03-18T03:19:23Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saurabh502](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/saurabh502/32/43507_2.png) [@Saurabh502](https://discuss.huggingface.co/u/Saurabh502)\
**Post date:** [March 18, 2025, 3:19am UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/1 "2025-03-18T03:19:23Z")

</div>

Hi, I have built a Gemini 2.0 flash based photo editing app with gradio ui. This app is running perfectly fine on my local system, but when I am trying to run it on spaces it is giving me **Error : No API Found**.

 ![e1](https://us1.discourse-cdn.com/hellohellohello/original/3X/6/4/646a62bd5ca4f08f055d7df888e653757ded180a.png)

I have used gemini api keys in secrects  
Code :  
[https://huggingface.co/spaces/Saurabh502/Gemini-photo/resolve/main/app.py](https://huggingface.co/spaces/Saurabh502/Gemini-photo/resolve/main/app.py)

Please let me know your thoughts, on how to resolve this. Thanks

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [March 18, 2025, 7:28am UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/2 "2025-03-18T07:28:00Z")

</div>

First of all, it doesn’t seem to be a problem with the code.  
It seems that installing google genai causes an error in Starlette and breaks Gradio…  
I’m currently looking for a workaround.

Edit:  
There seems to be some other condition.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [March 18, 2025, 8:23am UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/3 "2025-03-18T08:23:08Z")

</div>

I couldn’t avoid it…

But it’s probably just a bug, so it’ll be fixed eventually…

> **[Gemini Photo (bug) - a Hugging Face Space by John6666](https://huggingface.co/spaces/John6666/genai-error)**
>
> Photo edit app

 ![genai500](https://us1.discourse-cdn.com/hellohellohello/original/3X/2/1/212ff27471fdb19fde1257c8295c23a667da47d3.png)

```py
import gradio as gr
#from google import genai
#from google.genai import types

def generate_image():
    return None

with gr.Blocks(title="Image Generation and Editing App") as app:
    generate_button = gr.Button("Generate")
    generated_output = gr.Image(label="Generated Image")
    #generated_output = gr.Textbox(label="Generated Text") # this works
    generate_button.click(fn=generate_image, inputs=None, outputs=[generated_output])

app.queue().launch(ssr_mode=False)

```

```py
python-dotenv
google-genai

```

---

<div class="post-metadata">

**Author:** ![pp1](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pp1/32/43577_2.png) [@pp1](https://discuss.huggingface.co/u/pp1)\
**Post date:** [March 18, 2025, 1:48pm UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/4 "2025-03-18T13:48:58Z")

</div>

Is there a workaround for now. Im also getting the same issue  
TypeError: argument of type ‘bool’ is not iterable

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [March 18, 2025, 4:47pm UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/5 "2025-03-18T16:47:00Z")

</div>

Hmm… This space works…

> **[Gemini Image Edit - a Hugging Face Space by ameerazam08](https://huggingface.co/spaces/ameerazam08/Gemini-Image-Edit)**
>
> Discover amazing ML apps made by the community

```auto
google-genai==1.5.0
gradio
pydantic==2.10.6

```

---

<div class="post-metadata">

**Author:** ![pp1](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/pp1/32/43577_2.png) [@pp1](https://discuss.huggingface.co/u/pp1)\
**Post date:** [March 18, 2025, 4:58pm UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/6 "2025-03-18T16:58:57Z")

</div>

It works now. Thanks so much. Updating the requirements.txt file did the trick.

---

<div class="post-metadata">

**Author:** ![Saurabh502](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/saurabh502/32/43507_2.png) [@Saurabh502](https://discuss.huggingface.co/u/Saurabh502)\
**Post date:** [March 24, 2025, 4:20am UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/7 "2025-03-24T04:20:58Z")

</div>

> [@John6666](#):
>
> ```auto
> google-genai==1.5.0
> gradio
> pydantic==2.10.6
> 
> ```

It worked for me with below updates in requirement.txt  
google-genai==1.5.0  
gradio  
pydantic==2.10.6  
python-dotenv

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [March 29, 2025, 1:48pm UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/8 "2025-03-29T13:48:52Z")

</div>

from Discord

> Alain  
> Seems like it’a related with the latest pydantic: [ERROR: Exception in ASGI application · Issue #10662 · gradio-app/gradio · GitHub](https://github.com/gradio-app/gradio/issues/10662) And fixing the pydantic version on the requirements.txt seems to fix it in deed. Thanks!

> Just add `pydantic==2.10.6` at the beginning of requirements.txt

---

<div class="post-metadata">

**Author:** ![munibz](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/munibz/32/47116_2.png) [@munibz](https://discuss.huggingface.co/u/munibz)\
**Post date:** [May 8, 2025, 7:21am UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/9 "2025-05-08T07:21:13Z")

</div>

i am getting the same error on groq api, can anyone help me out iin this

---

<div class="post-metadata">

**Author:** ![DebasishDhal99](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/debasishdhal99/32/19893_2.png) [@DebasishDhal99](https://discuss.huggingface.co/u/DebasishDhal99)\
**Post date:** [May 27, 2025, 9:52pm UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/10 "2025-05-27T21:52:39Z")

</div>

I seem to be getting the same error. `No API Found`. I don’t even have an API used in the whole repo. I do have openai-whisper key in the secrets, but I am not using it anywhere.

requirements.txt file

```auto
deep_translator
gradio==5.6.0
pillow==11.0.0
pytesseract==0.3.13
openai-whisper==20240930
pydub==0.25.1
langcodes==3.5.0
langdetect==1.0.9

```

Update 1

- Removed the unused api keys, now I am getting `TypeError: argument of type 'bool' is not iterable`.

Update 2

- Downgraded `pydantic==2.10.6` and `gradio==5.6.0` as per the suggestion of @John6666, and it’s working. Interested ones can have a look here - [All In One Translation - a Hugging Face Space by DebasishDhal99](https://huggingface.co/spaces/DebasishDhal99/all-in-one-translation) (Shameless promotion)

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [May 28, 2025, 12:17am UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/11 "2025-05-28T00:17:02Z")

</div>

Try update gradio or fix pydantic version:

```auto
#gradio==5.6.0

```

or

```auto
gradio==5.6.0
pydantic==2.10.6

```

---

<div class="post-metadata">

**Author:** ![DebasishDhal99](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/debasishdhal99/32/19893_2.png) [@DebasishDhal99](https://discuss.huggingface.co/u/DebasishDhal99)\
**Post date:** [May 28, 2025, 4:24am UTC](https://discuss.huggingface.co/t/error-no-api-found/146226/12 "2025-05-28T04:24:34Z")

</div>

It worked. Really appreciate it. Damn, I shouldn’t have missed your previous comment where you already added the `pydantic` fix.
