0G Labs API Key API

The API Key API from 0G Labs — 2 operation(s) for api key.

Operations 4

GET /api-keys Get API key list #
POST /api-keys Create API key #
DELETE /api-keys/{keyId} Revoke API key #
PATCH /api-keys/{keyId} Update API key #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/0g-labs-api-key-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

0g-labs-api-key-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  description: 0G Router is an API gateway between users and the decentralized 0G Compute Provider network.
  title: 0G Router API Key API
  termsOfService: https://0g.ai/terms
  contact:
    name: 0G Labs
    url: https://0g.ai
    email: contact@0g.ai
  version: '1.0'
servers:
- url: /v1
tags:
- name: API Key
paths:
  /api-keys:
    get:
      security:
      - ManagementKeyAuth: []
      description: Get all API keys for current user
      tags:
      - API Key
      summary: Get API key list
      parameters:
      - description: 'Filter: active / revoked / expired / all (default all)'
        name: status
        in: query
        schema:
          type: string
      responses:
        '200':
          description: API key list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.APIKeyListResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
      operationId: getApiKeys
      x-operation-id-source: derived
    post:
      security:
      - ManagementKeyAuth: []
      description: Create a new API key for LLM service access
      tags:
      - API Key
      summary: Create API key
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_request.CreateAPIKeyRequest'
        description: API key configuration
      responses:
        '200':
          description: API key created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.CreateAPIKeyResponse'
        '400':
          description: Request error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
      operationId: postApiKeys
      x-operation-id-source: derived
  /api-keys/{keyId}:
    delete:
      security:
      - ManagementKeyAuth: []
      description: Revoke a specific API key
      tags:
      - API Key
      summary: Revoke API key
      parameters:
      - description: API Key ID
        name: keyId
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Revoked successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.RevokeAPIKeyResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
        '404':
          description: API key not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
      operationId: deleteApiKeysByKeyId
      x-operation-id-source: derived
    patch:
      security:
      - ManagementKeyAuth: []
      description: Update name / credit_limit / reset_period / expiration of an API key
      tags:
      - API Key
      summary: Update API key
      parameters:
      - description: API Key ID
        name: keyId
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_request.UpdateAPIKeyRequest'
        description: Patch payload
        required: true
      responses:
        '200':
          description: Updated key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.APIKeyItem'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
        '404':
          description: API key not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
        '409':
          description: Duplicate name
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
        '410':
          description: Key revoked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorResponse'
      operationId: patchApiKeysByKeyId
      x-operation-id-source: derived
components:
  schemas:
    github_com_0glabs_0g-router_pkg_response.ErrorDetail:
      type: object
      properties:
        code:
          type: string
          example: bad_request
        message:
          type: string
          example: Invalid request
        type:
          type: string
          example: invalid_request
    github_com_0glabs_0g-router_pkg_response.APIKeyListResponse:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.APIKeyItem'
        object:
          type: string
          example: list
    github_com_0glabs_0g-router_pkg_request.CreateAPIKeyRequest:
      type: object
      properties:
        allowed_models:
          description: 'AllowedModels is an optional allowlist of model IDs this key may

            invoke. Nil = no restriction. Empty slice = explicit empty list,

            rejected at validation (a key that can call no models is useless).'
          type: array
          items:
            type: string
        allowed_providers:
          description: 'AllowedProviders is an optional allowlist of provider addresses

            (hex, 0x-prefixed) this key may target. Same nil-vs-empty convention

            as AllowedModels.'
          type: array
          items:
            type: string
        credit_limit:
          description: 0G units; nil = unlimited
          type: string
        expiration:
          description: RFC3339, "no_expiration", or ""
          type: string
        name:
          type: string
        reset_period:
          description: never/daily/weekly/monthly; "" → never
          type: string
        trust_mode:
          description: 'TrustMode optionally pins this key to a single trust tier. Accepted

            values: "standard" | "verified" | "private" | "" (no pin). The wire

            shape is a value type rather than a pointer because the create path has

            no "leave unchanged" semantics — absent / empty / explicit "" all mean

            "no pin".'
          type: string
    github_com_0glabs_0g-router_pkg_response.CreateAPIKeyResponse:
      type: object
      properties:
        allowed_models:
          description: 'AllowedModels / AllowedProviders are ALWAYS present in the response

            (never omitted) — `[]` means "no restriction", a non-empty slice

            means "only these". Stable shape so clients can index without

            `field !== undefined` guards, and so a missing field cleanly

            signals "response truncated by middleware / bug" rather than "no

            allowlist". csvToSlice in the service layer materialises an empty

            slice (not nil) for the no-allowlist case to keep the contract.'
          type: array
          items:
            type: string
          example:
          - '["glm-5"]'
        allowed_providers:
          type: array
          items:
            type: string
          example:
          - '["0xabc..."]'
        created_at:
          type: string
          example: 2024-01-15 10:30:00+00:00
        credit_limit:
          type: string
          example: '1.5'
        currency:
          description: 'Currency is the unit of CreditLimit / Used: "0g" (0G decimals) or "usd"

            (USD decimals), following the account''s settlement mode. Without it a

            client can''t tell whether "1.5" means 1.5 0G or $1.50.'
          type: string
          example: 0g
        expires_at:
          type: string
          example: 2025-02-15 10:30:00+00:00
        key:
          description: Only shown once!
          type: string
        key_id:
          type: string
          example: abc12345
        key_preview:
          type: string
          example: sk-abcde…
        name:
          type: string
          example: my-api-key
        reset_period:
          type: string
          example: monthly
        revoked:
          type: boolean
          example: false
        status:
          description: active / revoked / expired
          type: string
          example: active
        trust_mode:
          description: 'TrustMode is the trust-tier pin for this key, or nil when the key

            has no pin (matches the API-key constraint table verbatim). Emitted

            as a pointer so callers can distinguish "no pin" from "pinned to

            the empty string"; the latter is rejected at create time, so a nil

            value is the only way the field is absent in practice.'
          type: string
          example: verified
        used:
          type: string
          example: '0.42'
    github_com_0glabs_0g-router_pkg_response.RevokeAPIKeyResponse:
      type: object
      properties:
        key_id:
          type: string
          example: abc12345
        message:
          type: string
          example: API key revoked
    github_com_0glabs_0g-router_pkg_response.ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/github_com_0glabs_0g-router_pkg_response.ErrorDetail'
        request_id:
          type: string
    github_com_0glabs_0g-router_pkg_request.UpdateAPIKeyRequest:
      type: object
      properties:
        allowed_models:
          description: "AllowedModels / AllowedProviders sparse-PATCH sentinels:\n  nil               → unchanged\n  non-nil empty []  → clear the allowlist (no restriction)\n  non-nil non-empty → replace the allowlist\n\nPointer to slice (rather than slice) so we can distinguish \"leave\nalone\" from \"clear\", matching how Scopes is handled on mgmt keys."
          type: array
          items:
            type: string
        allowed_providers:
          type: array
          items:
            type: string
        credit_limit:
          type: string
        expiration:
          type: string
        name:
          type: string
        reset_period:
          type: string
        trust_mode:
          description: 'TrustMode sparse-PATCH sentinels: nil → unchanged; "" → clear the

            pin (key falls back to no trust-mode restriction); any of

            standard|verified|private → set the pin.'
          type: string
    github_com_0glabs_0g-router_pkg_response.APIKeyItem:
      type: object
      properties:
        allowed_models:
          description: 'AllowedModels / AllowedProviders are ALWAYS present in the response

            (never omitted) — `[]` means "no restriction", a non-empty slice

            means "only these". Stable shape so clients can index without

            `field !== undefined` guards, and so a missing field cleanly

            signals "response truncated by middleware / bug" rather than "no

            allowlist". csvToSlice in the service layer materialises an empty

            slice (not nil) for the no-allowlist case to keep the contract.'
          type: array
          items:
            type: string
          example:
          - '["glm-5"]'
        allowed_providers:
          type: array
          items:
            type: string
          example:
          - '["0xabc..."]'
        created_at:
          type: string
          example: 2024-01-15 10:30:00+00:00
        credit_limit:
          type: string
          example: '1.5'
        currency:
          description: 'Currency is the unit of CreditLimit / Used: "0g" (0G decimals) or "usd"

            (USD decimals), following the account''s settlement mode. Without it a

            client can''t tell whether "1.5" means 1.5 0G or $1.50.'
          type: string
          example: 0g
        expires_at:
          type: string
          example: 2025-02-15 10:30:00+00:00
        key_id:
          type: string
          example: abc12345
        key_preview:
          type: string
          example: sk-abcde…
        name:
          type: string
          example: my-api-key
        reset_period:
          type: string
          example: monthly
        revoked:
          type: boolean
          example: false
        status:
          description: active / revoked / expired
          type: string
          example: active
        trust_mode:
          description: 'TrustMode is the trust-tier pin for this key, or nil when the key

            has no pin (matches the API-key constraint table verbatim). Emitted

            as a pointer so callers can distinguish "no pin" from "pinned to

            the empty string"; the latter is rejected at create time, so a nil

            value is the only way the field is absent in practice.'
          type: string
          example: verified
        used:
          type: string
          example: '0.42'
  securitySchemes:
    ApiKeyAuth:
      description: 'API key for inference, file upload, and async image endpoints. Format: "Bearer sk-..."'
      type: apiKey
      name: Authorization
      in: header
    ManagementKeyAuth:
      description: 'Management key for account read and API key management. Capabilities are scope-limited per key (account:read, keys:read, keys:create, keys:manage). Format: "Bearer mk-..."'
      type: apiKey
      name: Authorization
      in: header