Skip to content

chore/anthropic computer use-fix + evals section #391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@
"integrations/ai-apps",
"integrations/libraries/anythingllm",
"integrations/libraries/claude-code",
"integrations/libraries/anthropic-computer-use",
"integrations/libraries/cline",
"integrations/libraries/goose",
"integrations/libraries/janhq",
Expand Down Expand Up @@ -788,6 +789,13 @@
{
"tab": "Cookbook",
"groups": [
{
"group": "Evals",
"pages": [
"guides/use-cases/run-batch-evals",
"guides/prompts/llm-as-a-judge"
]
},
{
"group": "Prompt Engineering",
"pages": [
Expand Down Expand Up @@ -855,7 +863,6 @@
"pages": [
"guides/use-cases",
"guides/use-cases/librechat-web-search",
"guides/use-cases/run-batch-evals",
"guides/use-cases/few-shot-prompting",
"guides/use-cases/enforcing-json-schema-with-anyscale-and-together",
"guides/use-cases/emotions-with-gpt-4o",
Expand Down
2 changes: 2 additions & 0 deletions integrations/libraries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ title: "Overview"

<Card title="Claude Code" href="/integrations/libraries/claude-code" />

<Card title="Anthropic Computer Use" href="/integrations/libraries/anthropic-computer-use" />


<Card title="Instructor" href="/integrations/libraries/instructor" />

Expand Down
296 changes: 296 additions & 0 deletions integrations/libraries/anthropic-computer-use.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
---
title: "Anthropic Computer Use"
---

Anthropic computer use is fully supported in Portkey.
For more information on the computer use tool, please refer to the [Anthropic documentation](https://docs.anthropic.com/en/docs/agents-and-tools/tool-use/computer-use-tool).


### Usage
<CodeGroup>
```py Python
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",
strict_open_ai_compliance="false"


)

# Create the request
response = portkey.chat.completions.create(
anthropic_beta="computer-use-2025-01-24",
model="claude-opus-4-20250514",
max_tokens=3000,
thinking={
"type": "enabled",
"budget_tokens": 2030
},
stream=False,

tools=[
{
"type": "computer",
"computer": {
"name": "computer_20250124",
"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)
```
```ts NodeJS
import Portkey from 'portkey-ai';

// Initialize the Portkey client
const portkey = new Portkey({
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
virtualKey: "VIRTUAL_KEY", // Add your anthropic's virtual key
strictOpenAiCompliance: false
});

// Generate a chat completion
async function getChatCompletionFunctions() {
const response = await portkey.chat.completions.create({
model: "claude-4-opus-20250514",
anthropic_beta: "computer-use-2025-01-24",
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."
}
]
});
console.log(response);
}
// Call the function
getChatCompletionFunctions();
```
```sh cURL
curl "https://api.portkey.ai/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-provider: anthropic" \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "x-portkey-strict-open-ai-compliance: false" \
-d '{
"model": "claude-4-opus-20250514",
"anthropic_beta": "computer-use-2025-01-24",
"max_tokens": 3000,
"thinking": {
"type": "enabled",
"budget_tokens": 2030
},
"stream": false,
"tools": [
{
"type": "computer",
"computer": {
"name": "computer_20250124",
"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."
}
]
}'
```
</CodeGroup>





# Portkey Features
Now that you have enterprise-grade Anthropic Computer Use setup, let's explore the comprehensive features Portkey provides to ensure secure, efficient, and cost-effective AI-assisted development.

### 1. Comprehensive Metrics
Using Portkey you can track 40+ key metrics including cost, token usage, response time, and performance across all your LLM providers in real time. Filter these metrics by developer, team, or project using custom metadata.

<Frame>
<img src="/images/integrations/observability.png" width="600"/>
</Frame>

### 2. Advanced Logs
Portkey's logging dashboard provides detailed logs for every request made by Anthropic Computer Use. These logs include:
- Complete request and response tracking
- Code context and generation metrics
- Developer attribution
- Cost breakdown per coding session

<Frame>
<img src="/images/llms/openai/logs.png"></img>
</Frame>

### 3. Unified Access to 250+ LLMs

Easily switch between 250+ LLMs for different coding tasks. Use GPT-4 for complex architecture decisions, Claude for detailed code reviews, or specialized models for specific languages - all through a single interface.

### 4. Advanced Metadata Tracking
Track coding patterns and productivity metrics with custom metadata:
- Language and framework usage
- Code generation vs completion tasks
- Time-of-day productivity patterns
- Project-specific metrics

<Card title="Custom Metadata" icon="tag" href="/docs/product/ai-gateway/metadata">
</Card>

### 5. Enterprise Access Management

<CardGroup cols={2}>
<Card title="Budget Controls" icon="coins" href="/docs/product/ai-gateway/virtual-keys/budget-limits">
Set and manage spending limits per developer or team. Prevent budget overruns with automatic cutoffs.
</Card>

<Card title="Single Sign-On (SSO)" icon="key" href="/docs/product/enterprise-offering/org-management/sso">
Enterprise-grade SSO integration for seamless developer onboarding and offboarding.
</Card>

<Card title="Organization Management" icon="building" href="/docs/product/enterprise-offering/org-management">
Hierarchical structure with teams, projects, and role-based access control for development organizations.
</Card>

<Card title="Access Rules & Audit Logs" icon="shield-check" href="/docs/product/enterprise-offering/access-control-management#audit-logs">
Comprehensive audit logging for security compliance and code generation tracking.
</Card>
</CardGroup>

### 6. Reliability Features
<CardGroup cols={3}>
<Card title="Fallbacks" icon="life-ring" href="/product/ai-gateway/fallbacks">
Automatically switch between models if one fails, ensuring uninterrupted coding.
</Card>
<Card title="Conditional Routing" icon="route" href="/product/ai-gateway/conditional-routing">
Route requests based on code complexity or language requirements.
</Card>
<Card title="Load Balancing" icon="balance-scale" href="/docs/product/ai-gateway/load-balancing">
Distribute requests across multiple API keys or providers.
</Card>
<Card title="Caching" icon="database" href="/product/ai-gateway/caching">
Cache common code patterns to reduce costs and improve response times.
</Card>
<Card title="Smart Retries" icon="refresh" href="/product/ai-gateway/retries">
Automatic retry handling for failed requests with exponential backoff.
</Card>
<Card title="Budget Limits" icon="shield-check" href="/product/ai-gateway/virtual-keys/budget-limits">
Enforce spending limits to control development costs.
</Card>
</CardGroup>

### 7. Advanced Guardrails

Protect your codebase and enhance security with real-time checks on AI interactions:
- Prevent exposure of API keys and secrets
- Block generation of malicious code patterns
- Enforce coding standards and best practices
- Custom security rules for your organization
- License compliance checks

<Card title="Guardrails" icon="shield-check" href="/docs/product/guardrails">
Implement real-time protection for your development environment with automatic detection and filtering of sensitive code, credentials, and security vulnerabilities.
</Card>

# FAQs
<AccordionGroup>

<Accordion title="How do I track costs per developer?">
Portkey provides several ways to track developer costs:
- Create separate Virtual Keys for each developer
- Use metadata tags to identify developers
- Set up developer-specific API keys
- View detailed analytics in the dashboard
</Accordion>

<Accordion title="What happens if a developer exceeds their budget?">
When a developer reaches their budget limit:
1. Further requests will be blocked
2. The developer and admin receive notifications
3. Coding history remains available
4. Admins can adjust limits as needed
</Accordion>

<Accordion title="Can I use Anthropic Computer Use with local or self-hosted models?">
Yes! Portkey supports local models through Ollama and other self-hosted solutions. Configure your local endpoint as a custom provider in Portkey and use it with Anthropic Computer Use just like any other provider.
</Accordion>

<Accordion title="How do I ensure code security with AI assistance?">
Portkey provides multiple security layers:
- Guardrails to prevent sensitive data exposure
- Request/response filtering
- Audit logs for all interactions
- Custom security rules
- PII detection and masking
</Accordion>
</AccordionGroup>

# Next Steps

**Join our Community**
- [Discord Community](https://portkey.sh/discord-report)
- [GitHub Repository](https://github.com/Portkey-AI)



<Note>
For enterprise support and custom features for your development teams, contact our [enterprise team](https://calendly.com/portkey-ai).
</Note>
8 changes: 7 additions & 1 deletion integrations/libraries/autogen.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
---
title: "Autogen"
title: "Autogen (DEPRECATED)"
description: "AutoGen is a framework that enables the development of LLM applications using multiple agents that can converse with each other to solve tasks."
---


<Card title="This Integration is DEPRECATED" icon="robot" href="/integrations/agents/autogen">
Click here to check out the latest integration of Autogen with Portkey
</Card>


<Frame>
<img src="/images/libraries/libraries-1.png"/>
</Frame>
Expand Down
Loading
Loading