For API Integrators
Casola exposes OpenAI-compatible endpoints, so existing SDKs and tools work without changes. Create a token, make your first call, and set up a workflow — all in about ten minutes.
Create an API token
Section titled “Create an API token”- Sign in at casola.ai and go to Tokens (
/tokens). - Click Create token. Select the User Access scope group (
user:read+user:write) — this covers all inference and data operations. - Copy the token immediately. It’s only displayed once.
For service accounts or CI pipelines, admins can create tokens with narrower scopes. See the API Tokens guide and Scopes reference for the full list.
Make your first API call
Section titled “Make your first API call”Casola’s base URL is https://api.casola.ai. All OpenAI-compatible endpoints live under /openai/v1/.
curl https://api.casola.ai/openai/v1/images/generations \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "model": "flux", "prompt": "a neon-lit alley in the rain", "size": "1024x1024" }'Python (OpenAI SDK)
Section titled “Python (OpenAI SDK)”from openai import OpenAI
client = OpenAI( base_url="https://api.casola.ai/openai/v1", api_key="YOUR_TOKEN",)
response = client.images.generate( model="flux", prompt="a neon-lit alley in the rain", size="1024x1024",)print(response.data[0].url)TypeScript (OpenAI SDK)
Section titled “TypeScript (OpenAI SDK)”import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.casola.ai/openai/v1", apiKey: "YOUR_TOKEN",});
const response = await client.images.generate({ model: "flux", prompt: "a neon-lit alley in the rain", size: "1024x1024",});console.log(response.data[0].url);Use async requests for long-running jobs
Section titled “Use async requests for long-running jobs”Video generation and other heavy tasks can take longer than a typical HTTP timeout. Add "async": true to your request body to get a 202 response with a request ID, then poll for the result:
# Submitcurl -X POST https://api.casola.ai/openai/v1/images/generations \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"model": "flux", "prompt": "a sunset timelapse", "async": true}'
# Poll (replace REQUEST_ID)curl https://api.casola.ai/fal/requests/REQUEST_ID \ -H "Authorization: Bearer YOUR_TOKEN"Set up a workflow
Section titled “Set up a workflow”Workflows let you chain multiple models into a pipeline — for example, generate an image, then upscale it, then convert to video.
- Go to Workflows (
/workflows/new) in the UI to build a workflow visually. - Or create one via the API — see the Workflows guide for the DAG format and execution endpoints.
Evaluate models
Section titled “Evaluate models”Browse available models and their current status at /models or via the API:
curl https://api.casola.ai/openai/v1/models \ -H "Authorization: Bearer YOUR_TOKEN"Model status (online, warming up, standby, offline) is available at /api/model-status. See the Models reference for capabilities, latency profiles, and supported parameters.
Next steps
Section titled “Next steps”- API Tokens guide — scopes, rotation, and service accounts
- Workflows guide — build automated pipelines
- Models reference — all available models and their parameters
- API reference — full endpoint documentation