Skip to content

How to use openai-agents to call text2image API? #725

Not planned
@moseshu

Description

@moseshu

Please read this first

  • Have you read the docs?Agents SDK docs
  • Have you searched for related issues? Others may have had similar requests

Question

The following code uses the openai api to call the text2image function. How to convert this method to openai-agents to call it?

client = OpenAI(
    
    base_url="openai.com",
    api_key=os.environ.get("openai_key"),
)

response = client.images.generate(
    model="gpt-image-1",
    prompt="Fisheye lens, a cat's head, the picture shows the cat's facial features are distorted due to the shooting method.",
    size="1024x1024",
    response_format="url"        
)
print(response.data[0].url)

Activity

github-actions

github-actions commented on May 28, 2025

@github-actions

This issue is stale because it has been open for 7 days with no activity.

github-actions

github-actions commented on Jun 1, 2025

@github-actions

This issue was closed because it has been inactive for 3 days since being marked as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about using the SDKstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @moseshu

        Issue actions

          How to use openai-agents to call text2image API? · Issue #725 · openai/openai-agents-python