π OpenHands: AI-Driven Development
Update Cloud API docs (#9008)
mamoodic6a4324bda20
diff --git a/docs/static/img/api-key-generation.png b/docs/static/img/api-key-generation.pngnew file mode 100644index 0000000000..7506076401Binary files /dev/null and b/docs/static/img/api-key-generation.png differdiff --git a/docs/static/img/docs/api-key-generation.png b/docs/static/img/docs/api-key-generation.pngdeleted file mode 100644index 713a4a79d4..0000000000Binary files a/docs/static/img/docs/api-key-generation.png and /dev/null differdiff --git a/docs/usage/cloud/cloud-api.mdx b/docs/usage/cloud/cloud-api.mdxindex c4565cccaa..12438a6b70 100644--- a/docs/usage/cloud/cloud-api.mdx+++ b/docs/usage/cloud/cloud-api.mdx@@ -1,9 +1,11 @@---title: Cloud API-description: OpenHands Cloud provides a REST API that allows you to programmatically interact with the service. This guide explains how to obtain an API key and use the API to start conversations.+description: OpenHands Cloud provides a REST API that allows you to programmatically interact with OpenHands.+ This guide explains how to obtain an API key and use the API to start conversations and retrieve their status.----For more detailed information about the API, refer to the [OpenHands API Reference](https://docs.all-hands.dev/swagger-ui/).+For the available API endpoints, refer to the+[OpenHands API Reference](https://docs.all-hands.dev/api-reference).## Obtaining an API Key@@ -16,7 +18,7 @@ To use the OpenHands Cloud API, you'll need to generate an API key:5. Give your key a descriptive name (Example: "Development" or "Production") and select `Create`.6. Copy the generated API key and store it securely. It will only be shown once.-+## API Usage@@ -33,87 +35,81 @@ To start a new conversation with OpenHands to perform a task, you'll need to mak#### Examples-<details>-<summary>cURL</summary>--```bash-curl -X POST "https://app.all-hands.dev/api/conversations" \- -H "Authorization: Bearer YOUR_API_KEY" \- -H "Content-Type: application/json" \- -d '{- "initial_user_msg": "Check whether there is any incorrect information in the README.md file and send a PR to fix it if so.",- "repository": "yourusername/your-repo"- }'-```-</details>--<details>-<summary>Python (with requests)</summary>--```python-import requests--api_key = "YOUR_API_KEY"-url = "https://app.all-hands.dev/api/conversations"--headers = {- "Authorization": f"Bearer {api_key}",- "Content-Type": "application/json"-}--data = {- "initial_user_msg": "Check whether there is any incorrect information in the README.md file and send a PR to fix it if so.",- "repository": "yourusername/your-repo"-}--response = requests.post(url, headers=headers, json=data)-conversation = response.json()--print(f"Conversation Link: https://app.all-hands.dev/conversations/{conversation['conversation_id']}")-print(f"Status: {conversation['status']}")-```-</details>--<details>-<summary>TypeScript/JavaScript (with fetch)</summary>--```typescript-const apiKey = "YOUR_API_KEY";-const url = "https://app.all-hands.dev/api/conversations";-const headers = {- "Authorization": `Bearer ${apiKey}`,- "Content-Type": "application/json"-};+<Accordion title="cURL">+ ```bash+ curl -X POST "https://app.all-hands.dev/api/conversations" \+ -H "Authorization: Bearer YOUR_API_KEY" \+ -H "Content-Type: application/json" \+ -d '{+ "initial_user_msg": "Check whether there is any incorrect information in the README.md file and send a PR to fix it if so.",+ "repository": "yourusername/your-repo"+ }'+ ```+</Accordion>++<Accordion title="Python (with requests)">+ ```python+ import requests++ api_key = "YOUR_API_KEY"+ url = "https://app.all-hands.dev/api/conversations"++ headers = {+ "Authorization": f"Bearer {api_key}",+ "Content-Type": "application/json"+ }-const data = {- initial_user_msg: "Check whether there is any incorrect information in the README.md file and send a PR to fix it if so.",- repository: "yourusername/your-repo"-};+ data = {+ "initial_user_msg": "Check whether there is any incorrect information in the README.md file and send a PR to fix it if so.",+ "repository": "yourusername/your-repo"+ }-async function startConversation() {- try {- const response = await fetch(url, {- method: "POST",- headers: headers,- body: JSON.stringify(data)- });+ response = requests.post(url, headers=headers, json=data)+ conversation = response.json()- const conversation = await response.json();+ print(f"Conversation Link: https://app.all-hands.dev/conversations/{conversation['conversation_id']}")+ print(f"Status: {conversation['status']}")+ ```+</Accordion>- console.log(`Conversation Link: https://app.all-hands.dev/conversations/${conversation.id}`);- console.log(`Status: ${conversation.status}`);+<Accordion title="TypeScript/JavaScript (with fetch)">+ ```typescript+ const apiKey = "YOUR_API_KEY";+ const url = "https://app.all-hands.dev/api/conversations";- return conversation;- } catch (error) {- console.error("Error starting conversation:", error);+ const headers = {+ "Authorization": `Bearer ${apiKey}`,+ "Content-Type": "application/json"+ };++ const data = {+ initial_user_msg: "Check whether there is any incorrect information in the README.md file and send a PR to fix it if so.",+ repository: "yourusername/your-repo"+ };++ async function startConversation() {+ try {+ const response = await fetch(url, {+ method: "POST",+ headers: headers,+ body: JSON.stringify(data)+ });++ const conversation = await response.json();++ console.log(`Conversation Link: https://app.all-hands.dev/conversations/${conversation.id}`);+ console.log(`Status: ${conversation.status}`);++ return conversation;+ } catch (error) {+ console.error("Error starting conversation:", error);+ }}-}--startConversation();-```-</details>+ startConversation();+ ```+</Accordion>#### Response@@ -145,14 +141,12 @@ GET https://app.all-hands.dev/api/conversations/{conversation_id}#### Example-<details>-<summary>cURL</summary>--```bash-curl -X GET "https://app.all-hands.dev/api/conversations/{conversation_id}" \- -H "Authorization: Bearer YOUR_API_KEY"-```-</details>+<Accordion title="cURL">+ ```bash+ curl -X GET "https://app.all-hands.dev/api/conversations/{conversation_id}" \+ -H "Authorization: Bearer YOUR_API_KEY"+ ```+</Accordion>#### Responsediff --git a/docs/usage/installation.mdx b/docs/usage/installation.mdxindex 8e0ab99619..7d4f7a9af5 100644--- a/docs/usage/installation.mdx+++ b/docs/usage/installation.mdx@@ -12,7 +12,7 @@ To get started with OpenHands Cloud, visit [app.all-hands.dev](https://app.all-hFor more information see [getting started with OpenHands Cloud.](/usage/cloud/openhands-cloud)-## Running OpenHands Locally+## Running OpenHands on Your OwnRun OpenHands on your local system and bring your own LLM and API key.diff --git a/docs/usage/local-setup.mdx b/docs/usage/local-setup.mdxindex f059273cac..a3f5550efb 100644--- a/docs/usage/local-setup.mdx+++ b/docs/usage/local-setup.mdx@@ -62,17 +62,17 @@ A system with a modern processor and a minimum of **4GB RAM** is recommended to### Start the App```bash-docker pull docker.all-hands.dev/all-hands-ai/runtime:0.40-nikolaik+docker pull docker.all-hands.dev/all-hands-ai/runtime:0.41-nikolaikdocker run -it --rm --pull=always \- -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.40-nikolaik \+ -e SANDBOX_RUNTIME_CONTAINER_IMAGE=docker.all-hands.dev/all-hands-ai/runtime:0.41-nikolaik \-e LOG_ALL_EVENTS=true \-v /var/run/docker.sock:/var/run/docker.sock \-v ~/.openhands-state:/.openhands-state \-p 3000:3000 \--add-host host.docker.internal:host-gateway \--name openhands-app \- docker.all-hands.dev/all-hands-ai/openhands:0.40+ docker.all-hands.dev/all-hands-ai/openhands:0.41```You'll find OpenHands running at http://localhost:3000!