3.1 KiB
Agnes AI API Reference
Base host: https://apihub.agnes-ai.com
Authentication: Authorization: Bearer YOUR_API_KEY
Content type: application/json
Text
Endpoint: POST /v1/chat/completions
Model: agnes-2.0-flash
Required:
model: fixed asagnes-2.0-flashmessages: OpenAI-compatible chat messages
Optional:
temperature: numbertop_p: numbermax_tokens: numberstream: booleantools: arraytool_choice: string or object
Response is OpenAI-compatible and includes choices[].message.content and usage.
Image
Endpoint: POST /v1/images/generations
Model: agnes-image-2.1-flash
Required:
model: fixed asagnes-image-2.1-flashprompt: text instruction for image generation or editing
Optional:
size: output size such as1024x768extra_body.image: array of input image URLs for image-to-imageextra_body.response_format: useurlfor image URLs
Prompt structure:
[Subject] + [Scene / Environment] + [Style] + [Lighting] + [Composition] + [Quality Requirements]
For image-to-image, state what should change and what must remain unchanged.
For non-English user prompts, translate to English before sending the request. Preserve visual specifics and constraints.
Video
Create task endpoint: POST /v1/videos
Recommended result endpoint: GET /agnesapi?video_id={video_id}
Legacy task endpoint: GET /v1/videos/{task_id}
Model: agnes-video-v2.0
The video API is asynchronous. Create a task, then retrieve or poll by the returned video_id when present. Fall back to task_id only for older responses.
Use English prompts for video generation whenever possible. If the user prompt is not English, translate it to English first, preserving subject, action, scene, camera movement, lighting, style, and constraints.
Required:
model: fixed asagnes-video-v2.0prompt: text description of the video
Optional:
image: input image URL or image URL array for image-to-videomode: generation mode such asti2vidorkeyframesheight: integer, default768width: integer, default1152num_frames: integer, must be<= 441and satisfy8n + 1num_inference_steps: integerseed: integerframe_rate: number, supported range1-60negative_prompt: stringextra_body.image: array for multi-image video or keyframe modeextra_body.mode: set tokeyframesfor keyframe animation
Common status values:
queuedin_progresscompletedfailed
The create response may include both task_id and video_id; video_id is the recommended lookup identifier for new integrations. The completed response usually includes a video URL. In live responses this may appear as video_url, url, or remixed_from_video_id, plus size, seconds, and usage.duration_seconds.
Recommended video defaults:
- Standard:
width=1152,height=768,num_frames=121,frame_rate=24 - Short smoke test:
num_frames=81,frame_rate=24 - Reproducibility: set
seed
Error Codes
400: invalid request401: unauthorized; check API key404: task not found500: server error503: service busy; retry later