How can I use Fine Tuned Model that I have made in Google AI Studio

I have created a fine tuned model in Google AI Studio. Then, I clicked “Get Code” for Swift (as I am creating an IOS application), and then tried to implement it into my Xcode. I did EVERYTHINg such as setting up the credentials, implementing my bundle ID to the credentials, saving the API KEY in my Xcode project file, and copy pasting the code that I have earned in the Google AI Studio. Yet, it is telling me that I do not have permission to access. Can anyone help with making an application using this?

1 Like

Me too, I’m currently facing this problem! I hope there is a way to resolve this issue. I think it could be due to the OAuth Permissions but I have tried it.

Hi @Atom @Takumi_Otsuka

Welcome to the dev forum.

You cannot use the API key to access fine-tuned models, instead they can only be accessed using oAuth for some reason.

Thus you need to use oAuth as the authentication method.

Here’s a sample from cookbook to get you started:
cookbook/quickstarts/Tuning.ipynb at main · google-gemini/cookbook · GitHub

2 Likes

Thank you for your advice! Will take a look at the cookbook. Appreciate!

I created a fine tuned model in AI studio. and I got permission access.
but there’s no any console… could you help with it?

import google.generativeai as genai
import os
# if cannot import google.generativeai
# pip install --no-cache-dir google-generativeai

my_api_key = os.environ["GOOGLE_API_KEY"]
# client = genai.Client(api_key=my_api_key)
genai.configure(api_key=os.environ["GOOGLE_API_KEY"])

for m in genai.list_tuned_models():
  print(m)
  # not print at all..