@reverbia/portal 1.0.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.
Files changed (3) hide show
  1. package/README.md +58 -0
  2. package/package.json +29 -0
  3. package/swagger.json +7 -0
package/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # AI Portal
2
+
3
+ AI Portal is a prepaid escrow-based API gateway for wallet-authenticated LLM
4
+ usage. It provides an OpenAI-compatible API with on-chain settlement for AI
5
+ inference costs.
6
+
7
+ - `server`: Handles API requests, user authentication, billing, and manages
8
+ communication with LLM providers.
9
+ - `worker`: Processes AI inference settlements.
10
+
11
+ ## Getting Started
12
+
13
+ ### Prerequisites
14
+
15
+ - Go 1.23+
16
+ - PostgreSQL 15+
17
+ - ZetaChain RPC endpoint
18
+ - golangci-lint v2 (for development)
19
+ ```bash
20
+ go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
21
+ ```
22
+
23
+ ### Installation
24
+
25
+ ```bash
26
+ make install
27
+ ```
28
+
29
+ **Install only server**
30
+
31
+ ```bash
32
+ make install-server
33
+ ```
34
+
35
+ **Install only worker**
36
+
37
+ ```bash
38
+ make install-worker
39
+ ```
40
+
41
+ ### Configuration
42
+
43
+ See `.env.example` for available configuration options.
44
+
45
+ ### Running Tests
46
+
47
+ ```bash
48
+ make test
49
+ ```
50
+
51
+ ### Generate API specification and client
52
+
53
+ ```bash
54
+ make generate
55
+ ```
56
+
57
+ This command regenerates both the Swagger specification in `docs` and the
58
+ TypeScript client in `typescript`.
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@reverbia/portal",
3
+ "version": "1.0.0",
4
+ "description": "AI Portal is a prepaid escrow-based API gateway for wallet-authenticated LLM usage. It provides an OpenAI-compatible API with on-chain settlement for AI inference costs.",
5
+ "main": "index.js",
6
+ "directories": {
7
+ "doc": "docs"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "prepack": "node -e \"require('fs').copyFileSync('docs/swagger.json','swagger.json')\"",
12
+ "postpack": "node -e \"try{require('fs').unlinkSync('swagger.json')}catch(e){if(e.code!=='ENOENT')throw e;}\""
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/zeta-chain/ai-portal.git"
17
+ },
18
+ "keywords": [],
19
+ "author": "",
20
+ "license": "ISC",
21
+ "type": "commonjs",
22
+ "files": [
23
+ "swagger.json"
24
+ ],
25
+ "bugs": {
26
+ "url": "https://github.com/zeta-chain/ai-portal/issues"
27
+ },
28
+ "homepage": "https://github.com/zeta-chain/ai-portal#readme"
29
+ }
package/swagger.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "components": {"schemas":{"github_com_zeta-chain_ai-portal_pkg_llmapi.ChatCompletionRequest":{"properties":{"messages":{"description":"Messages is the conversation history","items":{"$ref":"#/components/schemas/github_com_zeta-chain_ai-portal_pkg_llmapi.Message"},"type":"array","uniqueItems":false},"model":{"description":"Model is the model identifier","type":"string"},"stream":{"description":"Stream indicates if response should be streamed","type":"boolean"}},"type":"object"},"github_com_zeta-chain_ai-portal_pkg_llmapi.ChatCompletionResponse":{"properties":{"choices":{"description":"Choices contains the completion choices","items":{"$ref":"#/components/schemas/github_com_zeta-chain_ai-portal_pkg_llmapi.Choice"},"type":"array","uniqueItems":false},"id":{"description":"ID is the completion ID","type":"string"},"model":{"description":"Model is the model used","type":"string"}},"type":"object"},"github_com_zeta-chain_ai-portal_pkg_llmapi.Choice":{"properties":{"finish_reason":{"description":"FinishReason indicates why the completion stopped","type":"string"},"index":{"description":"Index is the choice index","type":"integer"},"message":{"$ref":"#/components/schemas/github_com_zeta-chain_ai-portal_pkg_llmapi.Message"}},"type":"object"},"github_com_zeta-chain_ai-portal_pkg_llmapi.Message":{"description":"Message is the generated message","properties":{"content":{"description":"Content is the message content","type":"string"},"role":{"$ref":"#/components/schemas/github_com_zeta-chain_ai-portal_pkg_llmapi.Role"}},"type":"object"},"github_com_zeta-chain_ai-portal_pkg_llmapi.Role":{"description":"Role is the message role (system, user, assistant)","type":"string","x-enum-varnames":["RoleAssistant","RoleUser","RoleSystem"]},"github_com_zeta-chain_ai-portal_pkg_response.ErrorResponse":{"properties":{"error":{"type":"string"}},"type":"object"},"internal_api_handlers.HealthResponse":{"properties":{"status":{"description":"Status indicates the service health status","type":"string"},"timestamp":{"description":"Timestamp is the Unix timestamp of the response","type":"integer"},"version":{"description":"Version is the current API version","type":"string"}},"type":"object"}}},
3
+ "info": {"title":"","version":""},
4
+ "externalDocs": {"description":"","url":""},
5
+ "paths": {"/api/v1/chat/completions":{"post":{"description":"Generates a chat completion using the configured gateway.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/github_com_zeta-chain_ai-portal_pkg_llmapi.ChatCompletionRequest"}}},"description":"Chat completion request","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/github_com_zeta-chain_ai-portal_pkg_llmapi.ChatCompletionResponse"}}},"description":"OK"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/github_com_zeta-chain_ai-portal_pkg_response.ErrorResponse"}}},"description":"Bad Request"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/github_com_zeta-chain_ai-portal_pkg_response.ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Create chat completion","tags":["Chat"]}},"/health":{"get":{"description":"Returns the current health status of the service.","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/internal_api_handlers.HealthResponse"}}},"description":"OK"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/github_com_zeta-chain_ai-portal_pkg_response.ErrorResponse"}}},"description":"Internal Server Error"}},"summary":"Health check","tags":["Health"]}}},
6
+ "openapi": "3.1.0"
7
+ }