Create Images: Illustrate an Article
Idea and Step-by-Step Plan
Full Walkthrough
from openai import OpenAI
def complete_chat():
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
api_key = '<YOUR_AIMLAPI_KEY>'
client = OpenAI(
base_url='https://api.aimlapi.com',
api_key=api_key,
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[
{
"role": "user",
"content": "Read this article and generate a short prompt for illustration generation (no need to output the words like Prompt): Futuristic Cities. Cities of the future promise to radically transform how people live, work, and move. Instead of sprawling layouts, weāll see vertical structures that integrate residential, work, and public spaces into single, self-sustaining ecosystems. Architecture will adapt to climate conditions, and buildings will be energy-efficientāgenerating power through solar panels, wind turbines, and even foot traffic. Transportation will be fully autonomous and silent. Streets will be freed from traffic and pollution, with ground-level space given back to pedestrians and greenery. Drones, magnetic levitation pods, and underground tunnels will handle most transit. Artificial intelligence will manage traffic flow and energy distribution in real time, ensuring maximum efficiency and comfort. Digital technology will be woven into every part of urban life. Smart homes will adapt to residentsā habits, while city services will respond instantly to citizen needs. Virtual and augmented reality will blur the line between physical and digital spaces. These cities wonāt just be places to liveātheyāll be flexible, sustainable environments where technology truly serves people.",
},
],
)
print(response.choices[0].message.content)
if __name__ == "__main__":
complete_chat()Results
Last updated
Was this helpful?
