@x-otto/plugin-anthropic 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/otto-plugin.json +49 -0
- package/package.json +28 -0
- package/plugin-dist/meta.json +1 -0
- package/plugin-dist/plugin.cjs +52320 -0
- package/plugin-dist/plugin.js +104 -0
- package/plugin.ts +51 -0
- package/src/anthropic-oauth-client-identity.ts +101 -0
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @x-otto/plugin-anthropic
|
|
2
|
+
|
|
3
|
+
> OAuth-based Anthropic Claude provider plugin.
|
|
4
|
+
|
|
5
|
+
Provides access to Anthropic Claude models (Opus, Sonnet, Haiku) via OAuth-based Claude Pro/Max subscription authentication. Previously built-in, now a first-party plugin (RFC-148).
|
|
6
|
+
|
|
7
|
+
## How it works
|
|
8
|
+
|
|
9
|
+
This plugin implements a **code-based provider factory** that registers the `anthropic` provider ID with the otto provider system. It wraps the `anthropic-messages` wire protocol (provided by `plugin-otto-wire-protocols`) with the official CLI client identity shim — a set of request customizations required by Anthropic's subscription OAuth token classifier to avoid aggressive rate limiting.
|
|
10
|
+
|
|
11
|
+
OAuth flow uses PKCE (Proof Key for Code Exchange) declared in `otto-plugin.json` `contributes.oauth`.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
otto extension install plugin-anthropic
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Requires `plugin-otto-wire-protocols` to be installed and trusted.
|
|
20
|
+
|
|
21
|
+
## Configuration
|
|
22
|
+
|
|
23
|
+
Authenticate with Anthropic OAuth:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
otto auth login anthropic
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or set `ANTHROPIC_API_KEY` for API-key-based access (bypasses OAuth).
|
|
30
|
+
|
|
31
|
+
## Dependencies
|
|
32
|
+
|
|
33
|
+
- `@x-otto/provider` (workspace)
|
|
34
|
+
- `@x-otto/plugin` (dev, build-time only)
|
|
35
|
+
- `plugin-otto-wire-protocols` (runtime peer)
|
|
36
|
+
|
|
37
|
+
## Provided models
|
|
38
|
+
|
|
39
|
+
Claude Opus 4.8/4.7/4.6, Claude Sonnet 4.6, Claude Haiku 4.5 — all with context windows up to 1M tokens and extended reasoning support where applicable.
|
package/otto-plugin.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "plugin-anthropic",
|
|
3
|
+
"name": "Anthropic OAuth Provider",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "OAuth-based Anthropic Claude provider (RFC-122 PKCE template, RFC-148 code-based provider). Previously built-in, now a first-party plugin. OAuth client identity aligns with Anthropic's officially supported client (see anthropic-oauth-client-identity.ts for the technical rationale).",
|
|
6
|
+
"capabilities": ["provider"],
|
|
7
|
+
"engines": { "otto": ">=1.0.0" },
|
|
8
|
+
"dependsOn": ["plugin-otto-wire-protocols"],
|
|
9
|
+
"codeProviderIds": ["anthropic"],
|
|
10
|
+
"codeProviderModels": {
|
|
11
|
+
"anthropic": {
|
|
12
|
+
"baseUrl": "https://api.anthropic.com",
|
|
13
|
+
"imageConstraints": { "maxImagesPerRequest": 20, "maxDimensionPxIfOverLimit": 2000 },
|
|
14
|
+
"models": [
|
|
15
|
+
{ "id": "anthropic/claude-opus-4-8", "contextWindow": 1000000, "maxOutput": 128000, "cost": { "input": 5, "output": 25, "cacheRead": 0.5, "cacheWrite": 6.25 }, "strengths": ["planning", "reasoning", "knowledge", "coding"], "reasoning": true, "thinkingLevels": ["low", "medium", "high", "xhigh", "max"] },
|
|
16
|
+
{ "id": "anthropic/claude-opus-4-7", "contextWindow": 1000000, "maxOutput": 128000, "cost": { "input": 5, "output": 25, "cacheRead": 0.5, "cacheWrite": 6.25 }, "strengths": ["planning", "reasoning", "knowledge", "coding"], "reasoning": true, "thinkingLevels": ["low", "medium", "high", "xhigh", "max"] },
|
|
17
|
+
{ "id": "anthropic/claude-opus-4-6", "contextWindow": 1000000, "maxOutput": 32000, "cost": { "input": 15, "output": 75, "cacheRead": 1.5, "cacheWrite": 18.75 }, "strengths": ["planning", "reasoning", "knowledge", "coding"], "reasoning": true, "thinkingLevels": ["low", "medium", "high", "max"] },
|
|
18
|
+
{ "id": "anthropic/claude-sonnet-4-6", "contextWindow": 1000000, "maxOutput": 64000, "cost": { "input": 3, "output": 15, "cacheRead": 0.3, "cacheWrite": 3.75 }, "strengths": ["coding", "reasoning", "knowledge"], "reasoning": true, "thinkingLevels": ["low", "medium", "high", "max"] },
|
|
19
|
+
{ "id": "anthropic/claude-haiku-4-5", "contextWindow": 200000, "maxOutput": 16000, "cost": { "input": 0.8, "output": 4, "cacheRead": 0.08, "cacheWrite": 1 }, "strengths": ["speed", "coding"] }
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"codeProviderModelsEndpoints": {
|
|
24
|
+
"anthropic": {
|
|
25
|
+
"url": "https://api.anthropic.com/v1/models",
|
|
26
|
+
"responseFormat": "openai-list",
|
|
27
|
+
"authScheme": "auto",
|
|
28
|
+
"betaHeaderName": "anthropic-beta",
|
|
29
|
+
"headers": { "anthropic-version": "2023-06-01" }
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"contributes": {
|
|
33
|
+
"oauth": [
|
|
34
|
+
{
|
|
35
|
+
"kind": "pkce",
|
|
36
|
+
"id": "anthropic",
|
|
37
|
+
"name": "Anthropic",
|
|
38
|
+
"clientId": "9d1c250a-e61b-44d9-88ed-5944d1962f5e",
|
|
39
|
+
"authorizeUrl": "https://claude.ai/oauth/authorize",
|
|
40
|
+
"tokenUrl": "https://console.anthropic.com/v1/oauth/token",
|
|
41
|
+
"redirectUri": "https://console.anthropic.com/oauth/code/callback",
|
|
42
|
+
"scope": "org:create_api_key user:profile user:inference",
|
|
43
|
+
"loopbackPorts": [54545],
|
|
44
|
+
"tokenExchangeEncoding": "json",
|
|
45
|
+
"subscriptionScoped": true
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@x-otto/plugin-anthropic",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@x-otto/provider": "0.1.0-alpha.1"
|
|
7
|
+
},
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"@x-otto/plugin": "0.1.0-alpha.1"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"files": [
|
|
13
|
+
"otto-plugin.json",
|
|
14
|
+
"README.md",
|
|
15
|
+
"plugin.ts",
|
|
16
|
+
"src",
|
|
17
|
+
"plugin-dist"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public",
|
|
21
|
+
"registry": "https://registry.npmjs.org",
|
|
22
|
+
"tag": "alpha"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"test": "vitest run"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"apiVersion":1,"compilerVersion":"0.1.0-alpha.1","sourceHash":"a51a3121b7d7818e05965634d81a1e6fc76599522f7795d2176a30bf028e2152"}
|