Repository navigation
Expand file tree
/
Copy pathopencode.openai-compatible.jsonc
More file actions
126 lines (126 loc) · 4.22 KB
/
Copy pathopencode.openai-compatible.jsonc
File metadata and controls
126 lines (126 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Sample opencode.jsonc for the opencode-cache-manager plugin: a generic
// OpenAI-compatible proxy (OmniRoute, LiteLLM and the like) that serves Claude
// and other models on POST .../chat/completions.
//
// The test suite (tests/opencode-config.test.ts) parses this file and checks its
// -1h variants. Replace the baseURL placeholder with your proxy's URL. The apiKey
// is an env-var reference, so there are no secrets in this file.
//
// OpenCode's "openai-compatible" route places no cache breakpoints of its own. For
// Claude models the plugin adds them (tools, system, last message) and applies the
// TTL. Each "-1h" variant carries the x-cache-ttl sentinel header: the plugin
// applies that TTL and strips the header. For 1h it also adds
// anthropic-beta: extended-cache-ttl-2025-04-11, which some proxies need before
// they honour the 1h TTL.
//
// The plugin tells Claude models and GPT-5.6+ from the rest by their model ID, and
// Claude also by the model the first response names. If your proxy uses aliases
// the ID doesn't reveal, map them in cacheProfiles (GPT-5.6+ aliases always need it). Entries are matched against
// "<providerID>/<modelID>": plain text is a case-insensitive substring and
// /regex/flags is a regex. The value is "anthropic" (manage as Claude), "openai"
// (manage as GPT-5.6+) or "implicit" (observe only, never rewrite or ping).
//
// Some proxies (OmniRoute) drop prompt_cache_breakpoint, so the 12h cache of
// GPT-5.6+ doesn't reach OpenAI through them; see docs/SUPPORTED_PROVIDERS.md.
//
// Plugin options go in the plugin entry of your own opencode.jsonc, not in this
// file:
//
// "plugins": [
// {
// "package": "@noppu-labs/opencode-cache-manager",
// "options": {
// "openaiCompatible": true,
// "cacheProfiles": { "opus": "anthropic", "gpt": "implicit" }
// }
// }
// ]
{
"$schema": "https://opencode.ai/config.json",
"providers": {
"my-proxy": {
"name": "My proxy",
"package": "@opencode/ai/providers/openai-compatible",
"settings": {
"baseURL": "https://your-proxy.example/v1",
"apiKey": "{env:PROXY_API_KEY}",
},
"models": {
"claude-sonnet-5-5": {
"name": "Claude Sonnet 5.5",
"capabilities": {
"input": ["text", "image", "pdf"],
"output": ["text"],
},
"limit": {
"context": 1000000,
"output": 64000,
},
// Optional: a price lets the sidebar show savings in dollars. Per million
// tokens; a custom provider has no price unless you add one here.
// cache.write prices 5m and 30m writes; 1h and 12h writes are priced from
// input (2x and 2.5x).
// "cost": { "input": 3, "output": 15, "cache": { "read": 0.3, "write": 3.75 } },
"variants": [
{
"id": "low",
"settings": {
"reasoningEffort": "low",
},
},
{
"id": "medium",
"settings": {
"reasoningEffort": "medium",
},
},
{
"id": "high",
"settings": {
"reasoningEffort": "high",
},
},
{
"id": "low-1h",
"settings": {
"reasoningEffort": "low",
},
"headers": {
"x-cache-ttl": "1h",
},
},
{
"id": "medium-1h",
"settings": {
"reasoningEffort": "medium",
},
"headers": {
"x-cache-ttl": "1h",
},
},
{
"id": "high-1h",
"settings": {
"reasoningEffort": "high",
},
"headers": {
"x-cache-ttl": "1h",
},
},
],
},
"gpt-6-luna": {
"name": "GPT-6 Luna",
"capabilities": {
"input": ["text", "image"],
"output": ["text"],
},
"limit": {
"context": 400000,
"output": 128000,
},
},
},
},
},
}