Using Gemini with Ryzenth API Client
You can access Gemini models via an OpenAI-compatible API when using
This is handy for models like:
-
-
- Any Gemini proxy that works with OpenAI.
You can try Gemini-supported models too, like:
To create great images, use a prompt.
The API call setup is like OpenAI's (same as
This setup is similar to bots like @GeminiAIDev_Bot, which also use Gemini with OpenAI-style endpoints.
⚠️ Note:
If you don't have a Gemini key, skip this.
If you're using Ryzenth premium tools (like
That’s just for managing premium AI requests.
You can access Gemini models via an OpenAI-compatible API when using
RyzenthApiClient.This is handy for models like:
-
gemini-2.5-flash-
imagen-3.0-generate-002 (for image creation)- Any Gemini proxy that works with OpenAI.
import asyncio
from Ryzenth import RyzenthApiClient
GEMINI_API_KEY = ""
async def gemini_openai(prompt: str):
if not GEMINI_API_KEY:
return
clients = RyzenthApiClient(
tools_name=["gemini-openai"],
api_key={"gemini-openai": [{"Authorization": f"Bearer {GEMINI_API_KEY}"}]},
rate_limit=100,
use_default_headers=True
)
return await clients.post(
tool="gemini-openai",
path="/chat/completions",
json={
"model": "gemini-2.5-flash",
"reasoning_effort": "low",
"messages": [
{"role": "user", "content": prompt}
]
}
)
async def main():
response = await gemini_openai("Testing hello")
print(response)
asyncio.run(main())
You can try Gemini-supported models too, like:
"model": "imagen-3.0-generate-002"
To create great images, use a prompt.
The API call setup is like OpenAI's (same as
/chat/completions or /images/generate).This setup is similar to bots like @GeminiAIDev_Bot, which also use Gemini with OpenAI-style endpoints.
⚠️ Note:
If you don't have a Gemini key, skip this.
If you're using Ryzenth premium tools (like
/openai-imagen/turn-text), you don't need to use tool/openai.py.That’s just for managing premium AI requests.
from Ryzenth import RyzenthApiClient
DASHSCOPE_API_KEY = ""
async def qwen_imagen(prompt: str):
clients = RyzenthApiClient(
tools_name=["alibaba"],
api_key={"alibaba": [
{
"Authorization": f"Bearer {DASHSCOPE_API_KEY}",
"Content-Type": "application/json",
"X-DashScope-Async": "enable"
}
]},
rate_limit=100,
use_default_headers=True
)
response_status_json = await clients.post(
tool="alibaba",
path="/api/v1/services/aigc/text2image/image-synthesis",
json={
"model": "wan2.2-t2i-flash",
"input": {
"prompt": prompt
},
"parameters": {
"size": "1024*1024",
"n": 1
}
},
timeout=100
)
while True:
if response_status_json["output"]["task_status"] == "SUCCEEDED":
task_id = response_status_json["output"]["task_id"]
response_status = await clients.get(
tool="alibaba",
path=f"/api/v1/tasks/{task_id}",
timeout=100
)
if response_status["output"]["task_status"] == "SUCCEEDED":
return response_status["output"]["results"][0]["url"]
if response_status["output"]["task_status"] == "FAILED":
return "Ok Failed"
if response_status_json["output"]["task_status"] == "FAILED":
raise Exception("down gay")
break
result_url = await qwen_imagen("A flower shop with exquisite windows")
print(result_url)
Base: Alibaba Qwen AI (required api key)
Pypi: Ryzenth (not recommended)
Endpoints: text-to-img
Coder by: @zxyeor
You can image single or image multiple
from Ryzenth import RyzenthTools
new_client = RyzenthTools()
file_path = await new_client.aio_client.images.create("make a generate cat blue")
print(file_path)
file_path_multiple = await new_client.aio_client.images.create_multiple(
prompts=["make a generate cat blue", "make a generate cat yellow"],
concurrent_limit=3
)
print(file_path_multiple)
Update faster: https://pypi.org/project/Ryzenth/2.2.2/
New method:
• Happy Coding 😎
• Coder by @zxyeor
New method:
from Ryzenth import RyzenthTools
new_client = RyzenthTools()
response = await new_client.aio_client.chat.ask("what is telegram?")
print(response)
response_2 = await new_client.aio_client.chat.ask_ultimate("what is GTA 5?", model="grok")
print(response_2)
response_3 = await new_client.aio_client.images.upload_ask("Describe this image:", "/path/to/example.jpg")
print(response_3)
• Happy Coding 😎
• Coder by @zxyeor
if you're still on version 2.2.2 (which we don't advise):
So the syntax is updated on GitHub:
Now use
- New added
response = await new_client.aio_client.images.upload_ask("Describe this image:", "/path/to/example.jpg")
print(response)So the syntax is updated on GitHub:
Now use
create_upload_ask() instead of upload_ask().- New added
to_base64() and to_fileobj()response_content = await new.aio_client.images.create("make a generate cat blue")
await response_content.to_save()response = await new.aio_client.images.create_upload_ask("Describe this image:", "/path/to/example.jpg")
await response.to_result()response = await new.aio_client.chat.ask("What's the capital of Japan?")
print(await response.to_result())⚡1
Wih, fitur baru nih sekarang lo bisa generate gambar + caption cuma modal 1 API call doang ga perlu ribet² pake dua model terpisa tinggal kirim prompt langsung dapet gambar deskripsi keren ala gemini.
Kenapa pilih Ryzenth? 🗿
from Ryzenth import RyzenthTools
gemini_magic = RyzenthTools()
response = await gemini_magic.aio_client.images.create_gemini_and_captions(
"Bikin gambar 3D babi pake sayap jet + kacamata hitam"
"lagi terbang di atas kota cyberpunk yang ujan neon"
)
img, caption = await response.to_buffer_and_list()
await message.reply_photo(
photo=img,
caption=caption
)
Kenapa pilih Ryzenth? 🗿
Ga pake lama proses cepet ga nunggu loading kayak nunggu gorengan. ⏳
No ribet token ga perlu setel config bertele tele.
Dijamin stabil backend pake TypeScript jadi jarang error.
await new.aio_client.images.create()
await new.aio_client.images.create_gemini_and_captions()
await new.aio_client.images.create_gemini_to_edit("add background Lamborghini", "/path/to/example.jpg") # use response.to_buffer_and_list()
await new.aio_client.images.create_upload_to_ask()
await new.aio_client.images.create_multiple()
await new.aio_client.chat.ask()
await new.aio_client.chat.ask_ultimate()
Kadang orang tanya: "bisa nggak sih bikin library sendiri yang nyambung ke Ryzenth?"
Jawabannya: tentu bisa.
Kamu bebas kasih nama apa pun unik khas kamu lalu hubungkan langsung ke API Ryzenth.
Contoh:
Aku sendiri sudah lama bikin macam macam: Ryzenth, RyuzakiLib, sampai akenoai.
Semuanya lahir dari rasa penasaran ide iseng dan sedikit ambisi founder yang nggak bisa diem.
Jawabannya: tentu bisa.
Kamu bebas kasih nama apa pun unik khas kamu lalu hubungkan langsung ke API Ryzenth.
Contoh:
from Ryzenth import RyzenthApiClient
class CustomName:
def __init__(self):
self.client = RyzenthApiClient()
async def sapa(self):
pass
Aku sendiri sudah lama bikin macam macam: Ryzenth, RyuzakiLib, sampai akenoai.
Semuanya lahir dari rasa penasaran ide iseng dan sedikit ambisi founder yang nggak bisa diem.
Next Update 🚶♂️
Original code: https://t.me/c/1558215042/3287
qwen_response = await aio.client.images.create_qwen_flash()
url = await qwen_response.create_task_and_wait(return_url=True)
Original code: https://t.me/c/1558215042/3287
from Ryzenth import RyzenthTools
_ = RyzenthTools("your-api-key-from-qwen")
response = await _.aio_client.qwen_images.create_qwen_flash("make a generate cat blue")
url = await response.create_task_and_wait(
max_retries=120,
poll_interval=1.0,
return_url=True
)
print(url)
Coder by: @zxyeor
Pypi: https://pypi.org/project/Ryzenth/2.2.3/
Using Qwen AI for Image & Video Generation
With RyzenthTools, it is simple to use Qwen AI for generating images and videos in an asynchronous manner.
You can also access results by dot notation (
Notes:
If you are using version 2.2.3 or above, dot notation access may not be available due to the APIs changing.
For associated problems and updates, check the discussion:
🔗 GitHub Discussion
With RyzenthTools, it is simple to use Qwen AI for generating images and videos in an asynchronous manner.
You can also access results by dot notation (
output.results[0].url), which makes your code neater and easier to read.from Ryzenth import RyzenthTools
rt = RyzenthTools("your-api-key-from-qwen")
# ---------------------------
# 1. Generate Image
# ---------------------------
response = await rt.aio.qwen_images.create("make a generate cat blue")
output = await response.create_task_and_wait(max_retries=120, poll_interval=1.0)
print("Image URL:", output.results[0].url)
# ---------------------------
# 2. Generate Video
# ---------------------------
response_two = await rt.aio.qwen_videos.create("make a generate cat blue run")
output_two = await response_two.create_task_and_wait(max_retries=120, poll_interval=1.0)
print("Video URL:", output_two.video_url)
Notes:
If you are using version 2.2.3 or above, dot notation access may not be available due to the APIs changing.
For associated problems and updates, check the discussion:
🔗 GitHub Discussion
🚨 Service Notice: @aknuserbot Currently Down
Hey everyone, sorry but @aknuserbot is temporarily offline along with all our multi-bot services.
Why?
Every dang August our systems seem to hit a snag (blame it on August curse or server gremlins). We’re working on a fix
Thanks for bearing with us 🚶♂️
Sleep deprived devs who hate August
Hey everyone, sorry but @aknuserbot is temporarily offline along with all our multi-bot services.
Why?
Every dang August our systems seem to hit a snag (blame it on August curse or server gremlins). We’re working on a fix
Thanks for bearing with us 🚶♂️
Sleep deprived devs who hate August
New in version 2.2.4+
You can still create your own create functions and classes with
run() and create_task_and_wait() are now only supported for Qwen.You can still create your own create functions and classes with
run() just experiment and practice.response = await rt.aio.qwen_images.create("make a generate meme random")
output = await response.run()
response_chats = await rt.aio.qwen_chat.ask(
"Hey, what’s your name?",
stream=False,
include_usage=False,
enable_thinking=True
)
obj = await response_chats.to_obj()from Ryzenth import RyzenthTools
rt = RyzenthTools("api-key-from-qwen")
response = await rt.aio.qwen_images.to_edit(
prompt="Convert face to anime",
base_image_url="",
function_call="stylization_all"
)
f = await response.run()
print(f)
list:
- stylization_local
- description_edit
- description_edit_with_mask
- remove_watermark
- super_resolution
latest:
pip3 install git+https://github.com/TeamKillerX/Ryzenth.gitLatest Update
from Ryzenth import RyzenthTools
openai_st = RyzenthTools("sk-proj-*")
qwen_st = RyzenthTools("sk-*")
default_st = RyzenthTools()
await openai_st.aio.openai_responses.create()
await qwen_st.aio.qwen_chat.ask()
await default_st.aio.chat.ask()
from Ryzenth import RyzenthTools
rt = RyzenthTools("api-key-from-qwen")
response = await rt.aio.qwen_images.create("make a generate cat blue and background car Lamborghini gold")
output = await response.run()
img = await response.to_buffer_request(output.results[0].url)
await message.reply_photo(img)
Pypi: Project/Ryzenth
Source: TeamKillerX/Ryzenth
New in version 2.2.5+
from Ryzenth import RyzenthTools
rt = RyzenthTools("sk-proj-xxxx")
response = await rt.aio.openai_images.create("....")
dict_to_obj = await response.to_obj()
img = await response.to_buffer_request(
dict_to_obj.data[0].b64_json,
return_image_base64=True,
disabled_http=True
)