πŸš€ OneKey Gateway API RegistryΒΆ

Easily register, route, track, and monetize your APIs with OneKey Gateway. Convert your API to CLIs, Skills and more.

This guide walks you through:

A quick example using <api_endpoint> + How to register your API How to call it via OneKey Gateway (REST + CLI) Full JSON/YAML configuration examples Secure Authentication, support header API keys AUTH_HEADER, Bearer Token, etc.

QuickstartΒΆ

  1. Your Original API

Assume you already have an API:

curl -X POST <api_endpoint> \
  -H "Content-Type: application/json" \
  -H "<AUTH_HEADER>: $YOUR_API_KEY" \
  -d '<data>'

Example

export FINANCE_AGENT_API_KEY=your_finance_agent_key 

curl -X POST https://aiagenta2z.aiagenta2z.com/financeagent/api/v1/get_hk_stock_market_hkex \
  -H "Content-Type: application/json" \
  -H "X-Finance-Key: $FINANCE_AGENT_API_KEY" \
  -d '{"symbol_list": ["700", "1024"]}'
  1. Describe Your API (Meta)

Field

Example

Description

api_id

get_hk_stock_market_hkex

Unique API identifier

protocol

http, mcp, rpc

Default is http

endpoint

<api_endpoint>

Your API URL

method

POST

GET / POST

params

<data>

Request body or query

auth.type

API_KEY

Auth type

auth.header

X-Finance-Key

Header name

auth.value

$YOUR_API_KEY

Your API key

  1. Register Your API

Create a config file:

agent.json   # OR agent.yaml

Upload API and Agent meta using CLI agtm:

Get the registry Agent Marketplace Keys.

## Get your Onw Registry Keys
export AI_AGENT_MARKETPLACE_ACCESS_KEY="TEST_KEY_AI_AGENT_REGISTRY"

agtm upload --config ./agent.json
# or
agtm upload --config ./agent.yaml
  1. Call via OneKey Gateway

After registration, you can start to use onekey gateway to authenticate and start to track your API usage and routed by agent APIs and command lines CLI.

REST API Usage

Get the onekey-gateway keys DEEPNLP_ONEKEY_ROUTER_ACCESS Keys.

export DEEPNLP_ONEKEY_ROUTER_ACCESS=your_access_key

curl -X POST "https://agent.deepnlp.org/agent_router" \
-H "Content-Type: application/json" \
-H "X-OneKey: $DEEPNLP_ONEKEY_ROUTER_ACCESS" \
-d '{
  "unique_id": "aiagenta2z/financeagent",
  "api_id": "get_hk_stock_market_hkex",
  "data": {
    "symbol_list": ["700", "1024"]
  }
}'

CLI Usage of Your Registered API

npx onekey agent aiagenta2z/financeagent get_hk_stock_market_hkex '{"symbol_list": ["700", "1024"]}'

🧱 API Meta Schema

ParametersΒΆ

KEY

Type

Description

api_list

List

List of API Information

api_id

str

The unique Id to identifiy each API

protocol

str

http,mcp,rpc Default to http for API Calling

description

str

Description Usage

endpoint

str

endpoint URL

method

str

GET/POST

params

Dict

Parameters

auth

Dict

The authentication method of the API

Auth FieldsΒΆ

KEY

Type

Description

auth.type

str

API_KEY, BEAR_TOKEN

auth.header

str

Headers Key header

auth.value

str

Headers Value header

πŸ“¦ Full Example (JSON)

JsonΒΆ

agent.json file contents

{
  "publisher_id": "finance-agent",
  "name": "Finance Agent",
  "content": "The Finance Agent to get stock information from global stock market",
  "website": "https://www.my_first_agent.com",
  "field": "AI AGENT",
  "subfield": "Finance",
  "content_tag_list": "coding,python",
  "github": "https://github.com/aiagenta2z/FinanceAgent",
  "thumbnail_picture": "https://avatars.githubusercontent.com/u/242328252?s=200&v=4",
  "upload_image_files": "",
  "price_type": "PER_CALL",
  "price_per_call_credit": 10.0,
  "price_fixed_credit": 0.0,
  "price_subscription": "Basic: your basic plan introduction, Advanced: Your Advanced Plan introduction, etc.",
  "api_list": [
    {
      "api_id": "get_us_stock_market",
      "protocol": "http",
      "description": "Get US stock Market data",
      "endpoint": "https://financeagent.aiagenta2z.com/financeagent/v1/api/get_us_stock_market",
      "method": "GET",
      "params": {
        "symbol_list": "array[string]",
      },
      "auth": {
        "type": "API_KEY",
        "header": "X-API-Key",
        "value": "REGISTRY_API_GET_KEY"
      }
    },
    {
      "api_id": "get_hk_stock_market",
      "protocol": "http",
      "description": "Get Hong Kong stock market data",
      "endpoint": "https://financeagent.aiagenta2z.com/financeagent/v1/api/get_hk_stock_market",
      "method": "GET",
      "params": {
        "symbol_list": "array[string]",
        "market": "string=HK"
      },
      "auth": {
        "type": "API_KEY",
        "header": "X-API-Key",
        "value": "REGISTRY_API_GET_KEY"
      }
    },
    {
      "api_id": "get_cn_stock_market",
      "protocol": "http",
      "description": "Get China stock market data",
      "endpoint": "https://financeagent.aiagenta2z.com/financeagent/v1/api/get_cn_stock_market",
      "method": "GET",
      "auth": {
        "type": "API_KEY",
        "header": "X-API-Key",
        "value": "REGISTRY_API_GET_KEY"
      }
    },
    {
      "api_id": "get_uk_stock_market",
      "protocol": "http",
      "description": "Get UK stock market data",
      "endpoint": "https://financeagent.aiagenta2z.com/financeagent/v1/api/get_uk_stock_market",
      "method": "GET",
      "auth": {
        "type": "API_KEY",
        "header": "X-API-Key",
        "value": "REGISTRY_API_GET_KEY"
      }
    },
    {
      "api_id": "get_india_stock_market",
      "protocol": "http",
      "description": "Get India stock market data",
      "endpoint": "https://financeagent.aiagenta2z.com/financeagent/v1/api/get_india_stock_market",
      "method": "GET",
      "auth": {
        "type": "API_KEY",
        "header": "X-API-Key",
        "value": "REGISTRY_API_GET_KEY"
      }
    }
  ]
}

yamlΒΆ

agent.yaml file contents

publisher_id: "finance-agent"
name: "Finance Agent"
content: "The Finance Agent to get stock information from global stock market"
website: "https://www.my_first_agent.com"
field: "AI AGENT"
subfield: "Finance"
content_tag_list: "coding,python"
github: "https://github.com/aiagenta2z/FinanceAgent"
thumbnail_picture: "https://avatars.githubusercontent.com/u/242328252?s=200&v=4"
upload_image_files: ""
price_type: "PER_CALL"
price_per_call_credit: 10.0
price_fixed_credit: 0.0
price_subscription: "Basic: your basic plan introduction, Advanced: Your Advanced Plan introduction, etc."
api_list:
  - api_id: "get_us_stock_market"
    description: "Get US stock Market data"
    endpoint: "https://financeagent.aiagenta2z.com/financeagent/v1/api/get_us_stock_market"
    protocol: "http"
    method: "GET"
    params:
      symbol_list: "array[string]"
      market: "string=US"
    auth:
      type: "API_KEY"
      header: "X-API-Key"
      value: "REGISTRY_API_GET_KEY"

  - api_id: "get_hk_stock_market"
    description: "Get Hong Kong stock market data"
    endpoint: "https://financeagent.aiagenta2z.com/financeagent/v1/api/get_hk_stock_market"
    protocol: "http"
    method: "GET"
    params:
      symbol_list: "array[string]"
      market: "string=HK"
    auth:
      type: "API_KEY"
      header: "X-API-Key"
      value: "REGISTRY_API_GET_KEY"

  - api_id: "get_cn_stock_market"
    description: "Get China stock market data"
    endpoint: "https://financeagent.aiagenta2z.com/financeagent/v1/api/get_cn_stock_market"
    protocol: "http"
    method: "GET"
    auth:
      type: "API_KEY"
      header: "X-API-Key"
      value: "REGISTRY_API_GET_KEY"

  - api_id: "get_uk_stock_market"
    description: "Get UK stock market data"
    endpoint: "https://financeagent.aiagenta2z.com/financeagent/v1/api/get_uk_stock_market"
    protocol: "http"
    method: "GET"
    auth:
      type: "API_KEY"
      header: "X-API-Key"
      value: "REGISTRY_API_GET_KEY"

  - api_id: "get_india_stock_market"
    description: "Get India stock market data"
    endpoint: "https://financeagent.aiagenta2z.com/financeagent/v1/api/get_india_stock_market"
    protocol: "http"
    method: "GET"
    auth:
      type: "API_KEY"
      header: "X-API-Key"
      value: "REGISTRY_API_GET_KEY"

πŸ” Request Flow (Mental Model)

User / CLI
   ↓
OneKey Gateway
   ↓
Your Registered API
   ↓
Response returned + usage tracked + credits deducted

🎯 Summary

With just api_endpoint, data, auth, etc.

You can: Register your API Route via OneKey Gateway Enable CLI + agent usage Track + monetize automatically