Skip to content

Vision-and-Multimodal-Intelligence-Lab/Hackathon-2026

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Hackathon 2026 Poster Generation Reference

This repository is a reference implementation for a Hackathon 2026 poster generation project.

It demonstrates how to use Python with the OpenRouter API and the model:

  • google/gemini-3.1-flash-image-preview

If you want examples in other SDKs/languages, see the official OpenRouter API page:

What This Reference Code Covers

  • Calling OpenRouter from Python via the OpenAI-compatible client
  • Building multimodal user input:
    • pure text
    • pure image
    • text + multiple images
  • Sending local image files (auto-encoded to Base64 data URLs)
  • Decoding generated Base64 image outputs and saving to disk

Project Structure

  • example.py: main reference script
  • resource/: input image assets for prompts
  • generated_images/: output folder for generated poster images

Requirements

  • Python 3.10+
  • openai Python package

Install dependency:

pip install openai

Quick Start

  1. Open example.py
  2. Set your OpenRouter API key:
API_KEY = "ENTER_YOUR_KEY_HERE"
  1. Configure input mode and prompt:
INPUT_MODE = "text+image"  # "pure text" | "pure image" | "text+image"
INPUT_TEXT = "Your poster instructions..."
INPUT_IMAGES = ["resource/flyer.jpeg", "resource/speaker image.jpg"]
  1. Run:
python example.py

Generated images will be saved in generated_images/.

Input Modes

1) Pure Text

Use only a text prompt:

INPUT_MODE = "pure text"
INPUT_TEXT = "Design a clean academic seminar poster..."
INPUT_IMAGES = []

2) Pure Image

Use one or more reference images without text:

INPUT_MODE = "pure image"
INPUT_IMAGES = ["resource/flyer.jpeg"]

3) Text + Image (Recommended for poster tasks)

Combine instructions with one or more references:

INPUT_MODE = "text+image"
INPUT_TEXT = "Create a CS seminar poster in this style..."
INPUT_IMAGES = ["resource/flyer.jpeg", "resource/speaker image.jpg"]

Check remaining credit for a specific API key

To check the remaining credit for a specific key, you can call the key information endpoint and read the limit_remaining field from the returned JSON. Replace YOUR_API_KEY in the following command with the API key you have.

Example:

curl https://openrouter.ai/api/v1/auth/key -H "Authorization: Bearer YOUR_API_KEY" | python3 -c "import sys, json; print(json.load(sys.stdin)['data']['limit_remaining'])"

Notes

  • This repo is meant as reference code for hackathon development, not a production-ready framework.
  • Keep your API key private. Do not commit real keys to public repositories.
  • Model behavior and output format may change over time; always verify against the latest OpenRouter docs.

Official Documentation

About

Reference of Hackathon 2026 at Ole Miss

Resources

Stars

Watchers

Forks

Contributors

Languages