Tutorial
How to Call fibo-gen-1.5/text-to-image via HiAPI: curl and Python Guide
On this page
Build a Working Request with curl
fibo-gen-1.5/text-to-image is a hosted text-to-image model that you reach through the standard HiAPI request pattern. That detail matters more than it first appears: you are not downloading weights, standing up a GPU, or learning a model-specific SDK. You send an HTTP request with a model identifier and a prompt, and you get an image result back. The integration work lives in three places — how you shape the prompt, which parameters you set, and how you handle the response.
There are a few assumptions you can safely make before writing any code:
- Authentication is uniform. Every HiAPI call carries your API key in a request header. There is no per-model auth dance.
- The model is selected by name.
fibo-gen-1.5/text-to-imagegoes in the request body as the model field, exactly as written, including the/text-to-imagesuffix. - Generation is synchronous from the caller's perspective. You send a request, you wait, you receive output. Your timeout budget should reflect realistic generation latency rather than assuming an instant response.
- The response is structured. You get back a JSON envelope, not a raw binary blob, which means you parse it before you can use the image.
If you have already integrated any other HiAPI model, this will feel familiar. If this is your first one, the pattern you learn here transfers directly to everything else on the platform. The only genuinely model-specific knowledge is in the parameter choices, covered later in this guide.
The Same Call in Python
Start with the smallest call that can succeed. Export your key so it never lands in shell history in plaintext:
export HIAPI_API_KEY="your_api_key_here"
Then send the request:
curl -sS -X POST "https://api.hiapi.ai/v1/images/generations" \
-H "Authorization: Bearer $HIAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "fibo-gen-1.5/text-to-image",
"prompt": "a weathered fisherman mending a net on a wooden dock at dawn, overcast light, 35mm photograph",
"size": "1024x1024",
"n": 1
}'
Three things are worth calling out, because they are where paste-and-pray attempts usually break:
- The model string is exact.
fibo-gen-1.5/text-to-image— notfibo-gen-1.5, not a capitalized variant. A near-miss returns a model-not-found style error rather than silently falling back. - The key goes in the
Authorizationheader as a bearer token. Do not put it in the body or a query string. Content-Type: application/jsonis mandatory. Without it, some proxies and gateways will mangle the payload before it reaches the API.
If you want to see exactly what came back — headers included — add -i to the curl invocation. That is the single most useful debugging habit when a response looks empty: it tells you whether you got a 200 with an unexpected body shape, or a non-2xx you need to handle. Pipe the output through jq . to pretty-print the JSON while you are exploring.
Once this works, swap the prompt and re-run. Keeping the rest of the call identical isolates prompt changes from structural changes.
Putting It Into Production
Moving from a working script to a dependable integration is mostly about the boring parts. The checklist:
- Keys stay out of code. Load from the environment or a secrets manager, never commit them, and rotate on a schedule you can actually keep. Use separate keys for development and production so a leaked dev key does not take down live traffic.
- Timeouts are explicit and measured. Set a ceiling based on observed generation latency in your own workload, not a guess. Log how long each call actually takes so you can defend the number.
- Retries are bounded and selective. Retry on transient failures — timeouts, rate conditions — with exponential backoff and a hard attempt cap. Never retry a malformed payload or an auth failure; it will fail identically every time and waste your quota.
- Output is validated before it is trusted. Check that you decoded a non-trivial number of bytes, and that the file opens as a valid image. A zero-byte or truncated file that reaches a CDN is worse than a loud failure at generation time.
- Every generation is recorded. Store the prompt, parameters, response, and a timestamp together. This is what makes reproducibility and cost attribution possible later.
- The call is behind a function, not scattered. One
generate()used everywhere means you patch retry logic, timeouts, and logging in a single place.
Start with one clean fibo-gen-1.5/text-to-image request from curl, port it to Python, then add the operational layers around it. The request shape never changes — only the guarantees you wrap around it.
Related articles
View all articles →-
Tutorial
gpt-6.2-sol in Practice: 5 High-Value Uses of a Text Model in Business
-
Tutorial
gpt-6.2-astra Practical Guide: Integration and Implementation Key Points for 5 High-Value Text Scenarios
A Developer's Checklist from Scenario Selection to Engineering Implementation
-
Tutorial
Tripo H3.1 Practical Application Scenarios: 5 High-Value Use Cases and Implementation Essentials
From text-to-3D to multiview reconstruction: choosing the right mode and parameters by business scenario