Overview
The OpenAI Responses API is a stateful API designed for long-running tasks that require asynchronous processing. We’ve made our API compatible with the Responses API, allowing you to use the OpenAI SDK with Manus for complex reasoning tasks, document analysis, and multi-step workflows. Manus handles the heavy lifting while you track progress asynchronously, making it perfect for automation, research, and complex applications.Prerequisites
Before you begin:- Sign up for a Manus account
- Generate your API key from the dashboard
- Install Python 3.10 or higher
Installation
Install the OpenAI Python SDK:
Note: We’ve tested compatibility with OpenAI Python SDK versions up to 1.100.2.
Manus uses API key-based authentication via headers. Set up your client with these approaches:
The
api_key parameter to the OpenAI client can be any placeholder value - Manus reads the actual API key from the API_KEY header.Your First Task
When working with Manus, tasks run asynchronously, meaning they don’t block your program while they’re being processed. Before we dive into the code, let’s cover the different statuses a task can have:- running: The initial state when you first dispatch a task. It means the agent is actively working on your request.
- pending: The agent has paused its work and is waiting for more input from a user. This often happens in interactive sessions.
- completed: The task finished successfully, and the full results are now available to be retrieved.
- error: The task could not be completed because it ran into an error.
Creating a Task
First, Let’s create a task using the Manus API. When you do this, you receive a response object that contains a unique id for your task. This id is crucial for tracking the task’s status.retrieve method to get the latest status of the task. This can be done with a simple while loop.
Response object to get the full conversation.
The final result, including all messages from both the user and the assistant are contained in the output field.
File Management
The Files API allows you to manage file uploads separately from task creation. This is useful when you want to reuse files across multiple tasks or pre-upload large files.Uploading Files
To upload a file, first create a file record to get an upload URL, then upload your file to that URL:The presigned upload URL expires in 3 minutes for security. Complete your upload before it expires.
File Status
Files progress through the following states:pending: File record created, waiting for upload to completeuploaded: File successfully uploaded and ready to use in tasksdeleted: File has been deleted (manually or automatically after 48 hours)
Retrieving File Details
Check the status and details of your uploaded file:Listing Files
Retrieve all files you’ve uploaded:Deleting Files
Remove files you no longer need:Working with Content
Text Input
For simple text-based tasks, useinput_text:
Files
Include various file types in your tasks using these methods:- File ID
- Public URL
- Base64 Upload
- Documents: PDF, DOCX, TXT, MD
- Spreadsheets: CSV, XLSX
- Code: JSON, YAML, Python, JavaScript, and more
When using base64, include the proper MIME type prefix (e.g.,
data:application/pdf;base64, for PDFs).Images
Include images for visual analysis using these methods:- Public URL
- Base64 Upload
- PNG, JPEG/JPG, GIF, WebP
For images, use
"type": "input_image" and provide the URL via image_url. Include proper MIME type prefixes for base64 uploads.Multi-turn Conversations
Build sophisticated workflows by continuing conversations across multiple requests. Just use theprevious_response_id or task_id to link to the previous conversation.
Context Preservation: The agent remembers previous context, uploaded files, and intermediate results across conversation turns, enabling complex multi-step tasks.
- Using previous_response_id
- Using task_id
Projects
Projects allow you to organize tasks and apply consistent instructions across multiple tasks. When you assign a task to a project, the project’s instruction is automatically applied.Create and manage projects via the Projects API. The project’s instruction will be applied to all tasks created within it.
Task Management
Retrieve all your tasks, including those created through the Manus webapp:This returns all your tasks, not just API-created ones.
Filtering and Search
Find specific tasks using these parameters:- By Status
- By Search Query
- By Date Range
data: Array of task objectsfirst_id: ID of first task in resultslast_id: ID of last task (for pagination)has_more: Whether more tasks exist
Pagination
Handle large numbers of tasks efficiently:Pagination Direction:
order=desc moves from newest → oldest, order=asc moves from oldest → newest.Deleting Tasks
Remove completed tasks to keep your workspace organized:Updating Tasks
Modify task settings after creation:- Enabling sharing after task completion
- Hiding/showing tasks in your workspace
- Renaming tasks for better organization
Update only the fields you want to change - others remain unchanged.
Sharing & Visibility
Public Sharing
Make tasks accessible to others using shareable links:Task Visibility
Control which tasks appear in your workspace:Best Practices
Workspace Management:- Delete completed tasks you no longer need
- Use
hide_in_task_listfor automated workflows to avoid clutter - Save important outputs before deleting tasks
- Only enable
create_shareable_linkfor non-sensitive tasks - Be mindful of what information you’re sharing publicly
- Use environment variables for API keys in production
- Use appropriate agent profiles (
manus-1.6-litefor simple tasks,manus-1.6for general tasks,manus-1.6-maxfor complex analysis) - Monitor task status rather than polling constantly
- Batch similar tasks when possible for efficiency
- Always check task status before accessing results
- Handle failed tasks gracefully in your applications
- Save task IDs for debugging and monitoring