Python
Together AI SDK (Python)
from together import Togetherimport osclient = Together( api_key=os.environ.get("TOGETHER_API_KEY"),)response = client.images.generate( model="black-forest-labs/FLUX.1-schnell", steps=4, prompt="A cartoon of an astronaut riding a horse on the moon",)print(response.data[0].url)
{ "id": "<string>", "model": "<string>", "object": "list", "data": [ { "index": 123, "b64_json": "<string>", "type": "b64_json" } ] }
Use an image model to generate an image for a given prompt.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Bearer <token>
<token>
Image generated successfully
The response is of type object.
object
Was this page helpful?