Anthropic computer use is fully supported in Portkey. For more information on the computer use tool, please refer to the Anthropic documentation.

Usage

from portkey_ai import Portkey

# Initialize the Portkey client
portkey = Portkey(
    api_key="PORTKEY_API_KEY",  # Replace with your Portkey API key
    virtual_key="VIRTUAL_KEY",   # Add your provider's virtual key
)

# Create the request
response = portkey.chat.completions.create(
  model="claude-4-opus-20250514",
  max_tokens=3000,
  thinking={
      "type": "enabled",
      "budget_tokens": 2030
  },
  stream=False,
  tools=[
    {
        type: "computer",
        computer: {
            name: "computer_20250124", # This is the version of the tool
            display_width_px: 1024,
            display_height_px: 768,
            display_number: 1
        }
    },
    {
        type: "text_editor_20250429",
        name: "str_replace_based_edit_tool"
    },
    {
        type: "bash_20250124",
        name: "bash"
    }
  ],
  messages=[
    {
        role: "user",
        content: "Save a picture of a cat to my desktop."
    }
  ]
)
print(response)