import json
from http.server import BaseHTTPRequestHandler, HTTPServer
models=[]
for i in range(1,81):
 s=f'model-{i:03d}'
 models.append(dict(id=s,modelID=s,providerID='demo',name=f'Demo Model {i:03d}',package='@opencode/ai/providers/openai-compatible',settings={},capabilities=dict(tools=True,input=['text'],output=['text']),variants=[],time=dict(released=1700000000000),cost=[],status='active',enabled=True,limit=dict(context=100000,input=90000,output=10000)))
class Handler(BaseHTTPRequestHandler):
 def do_GET(self):
  path=self.path.split('?')[0]
  if path=='/api/info': body=dict(version='2.0.18',pid=1,urls=['http://127.0.0.1:18937'],paths=dict(tmp='/synthetic'))
  elif path=='/api/model': body=dict(location=dict(directory='/synthetic'),data=models)
  elif path=='/api/provider': body=dict(location=dict(directory='/synthetic'),data=[dict(id='demo',integrationID='demo',name='Demo',activation='enabled',package='@opencode/ai/providers/openai-compatible',settings={})])
  else:
   self.send_response(404); self.end_headers(); return
  self.send_response(200); self.send_header('Content-Type','application/json'); self.end_headers(); self.wfile.write(json.dumps(body).encode())
HTTPServer(('127.0.0.1',18937),Handler).serve_forever()
