File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,30 +52,6 @@ $ bun run packages/opencode/src/index.ts
5252
5353### FAQ
5454
55- #### How do I use this with OpenRouter?
56-
57- OpenRouter is not in the Models.dev database yet, but you can configure it manually.
58-
59- ``` json title="opencode.json"
60- {
61- "$schema" : " https://opencode.ai/config.json" ,
62- "provider" : {
63- "openrouter" : {
64- "npm" : " @openrouter/ai-sdk-provider" ,
65- "name" : " OpenRouter" ,
66- "options" : {},
67- "models" : {
68- "anthropic/claude-3.5-sonnet" : {
69- "name" : " Claude 3.5 Sonnet"
70- }
71- }
72- }
73- }
74- }
75- ```
76-
77- And then to configure an api key you can do ` opencode auth login ` and select "Other -> 'openrouter'"
78-
7955#### How is this different than Claude Code?
8056
8157It's very similar to Claude Code in terms of capability. Here are the key differences:
Original file line number Diff line number Diff line change @@ -290,6 +290,34 @@ export namespace Server {
290290 return c . json ( session )
291291 } ,
292292 )
293+ . post (
294+ "/session_unshare" ,
295+ describeRoute ( {
296+ description : "Unshare the session" ,
297+ responses : {
298+ 200 : {
299+ description : "Successfully unshared session" ,
300+ content : {
301+ "application/json" : {
302+ schema : resolver ( Session . Info ) ,
303+ } ,
304+ } ,
305+ } ,
306+ } ,
307+ } ) ,
308+ zValidator (
309+ "json" ,
310+ z . object ( {
311+ sessionID : z . string ( ) ,
312+ } ) ,
313+ ) ,
314+ async ( c ) => {
315+ const body = c . req . valid ( "json" )
316+ await Session . unshare ( body . sessionID )
317+ const session = await Session . get ( body . sessionID )
318+ return c . json ( session )
319+ } ,
320+ )
293321 . post (
294322 "/session_messages" ,
295323 describeRoute ( {
Original file line number Diff line number Diff line change @@ -159,6 +159,14 @@ export namespace Session {
159159 return share
160160 }
161161
162+ export async function unshare ( id : string ) {
163+ await Storage . remove ( "session/share/" + id )
164+ await update ( id , ( draft ) => {
165+ draft . share = undefined
166+ } )
167+ await Share . remove ( id )
168+ }
169+
162170 export async function update ( id : string , editor : ( session : Info ) => void ) {
163171 const { sessions } = state ( )
164172 const session = await get ( id )
Original file line number Diff line number Diff line change @@ -70,4 +70,11 @@ export namespace Share {
7070 . then ( ( x ) => x . json ( ) )
7171 . then ( ( x ) => x as { url : string ; secret : string } )
7272 }
73+
74+ export async function remove ( id : string ) {
75+ return fetch ( `${ URL } /share_delete` , {
76+ method : "POST" ,
77+ body : JSON . stringify ( { id } ) ,
78+ } ) . then ( ( x ) => x . json ( ) )
79+ }
7380}
Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ export namespace Storage {
2424 }
2525 } )
2626
27+ export async function remove ( key : string ) {
28+ const target = path . join ( state ( ) . dir , key + ".json" )
29+ await fs . unlink ( target ) . catch ( ( ) => { } )
30+ }
31+
2732 export async function readJSON < T > ( key : string ) {
2833 return Bun . file ( path . join ( state ( ) . dir , key + ".json" ) ) . json ( ) as Promise < T >
2934 }
You can’t perform that action at this time.
0 commit comments