1gateway AI API

The Ai API from 1gateway — 1 operation(s) for ai.

Operations 1

GET /v1/ai/llm-prices LLM model price lookup, token cost calculator and cheapest-model finder #

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/1gateway-dev:1gateway-dev-ai-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

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

1gateway-dev-ai-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: 1gateway AI API
  version: 0.1.1
  description: '1gateway lets AI agents buy the data and APIs they need, one call at a time: no signup, no API key, paid per request with USDC on Base or Solana via x402. Coverage: company and compliance checks (sanctions, KYB, SEC filings, Korean companies), Korean real estate, trade and macro data, onchain and market data, and agent utilities such as document-to-Markdown. Every response names its source. Failed calls are never charged.'
  x-guidance: 'Use this API when an agent needs data as English JSON with pay-per-call access and no signup. Common tasks: Korea apartment sale transactions and district price summaries, Korean public holidays, Korea company KYB (company resolve, profile, NTS business status, DART filings, supplier check), Korean HWP/HWPX to Markdown, web page to Markdown (web read), and document extract (PDF, DOCX, HWP/HWPX or web page to structured JSON). Current coverage is South Korea: apartment sale prices (MOLIT), exports/imports and 10-day export flash (Korea Customs), Bank of Korea statistics (ECOS), weather forecast by lat/lon (KMA), holidays (KASI); more APIs and countries are coming. Base onchain reads: token risk, wallet balances, token info, transaction status. Also: document → Markdown conversion for web pages, PDF, DOCX and Korean HWP/HWPX (price by detected type, decided before payment). Every /v1 endpoint is paid: call it, receive HTTP 402 with PAYMENT-REQUIRED, pay with an x402 client (USDC on Base or Solana, same price) and retry. No charge on failure: settlement happens only on 2xx; 4xx/5xx are never charged. Agent guide: https://1gateway.dev/agents.md. Status: https://1gateway.dev/status. MCP (Streamable HTTP) is available at https://1gateway.dev/mcp: initialize and tools/list are free, tools/call is paid via x402 _meta.'
  contact:
    email: contact@1gateway.dev
servers:
- url: https://1gateway.dev
tags:
- name: AI
paths:
  /v1/ai/llm-prices:
    get:
      operationId: llm_model_prices
      summary: LLM model price lookup, token cost calculator and cheapest-model finder
      description: 'Use when an agent must price an LLM call or pick the cheapest model. Input: model (up to 5, comma list) plus optional input_tokens, output_tokens, requests; or no model plus mode, provider, min_context, capabilities (vision, function_calling...). Output: JSON USD per 1M input/output tokens, cached/batch prices, context window, provider, capabilities, cost estimate or cheapest ranking, as_of + source commit. Example: ?model=gpt-4o&input_tokens=12000&output_tokens=800'
      x-payment-info:
        price:
          mode: fixed
          currency: USD
          amount: '0.004000'
        protocols:
        - x402: {}
      x-x402:
        price: $0.004
        scheme: exact
        network: eip155:8453
        networks:
        - eip155:8453
        - solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
        asset: USDC
        kind: single
        source: LiteLLM model_prices_and_context_window.json (MIT License, Copyright (c) 2023 Berri AI), pinned commit bundled at build time; snapshot date and commit returned as as_of/source
      parameters:
      - name: model
        in: query
        required: false
        description: Model name(s), up to 5 comma-separated (gpt-4o, claude-sonnet-4-5, gemini/gemini-2.5-flash). Also lists the same model at other providers. Omit to rank the cheapest models. Unknown → 400 with suggestions (not charged)
        schema:
          type: string
          maxLength: 400
          example: gpt-4o
      - name: input_tokens
        in: query
        required: false
        description: Input (prompt) tokens per request, for the cost estimate and ranking
        schema:
          type: integer
          minimum: 0
          maximum: 100000000
          example: 12000
      - name: output_tokens
        in: query
        required: false
        description: Output (completion) tokens per request
        schema:
          type: integer
          minimum: 0
          maximum: 100000000
          example: 800
      - name: requests
        in: query
        required: false
        description: Number of requests to multiply the estimate by (default 1)
        schema:
          type: integer
          minimum: 1
          maximum: 1000000000
          example: 1000
      - name: provider
        in: query
        required: false
        description: 'LiteLLM provider id filter: openai, anthropic, gemini, vertex_ai, bedrock, azure, groq, deepseek, mistral...'
        schema:
          type: string
          pattern: ^[A-Za-z0-9_.-]{1,40}$
          example: openai
      - name: mode
        in: query
        required: false
        description: Model type for the cheapest search (default chat; chat includes responses-API models). Ignored when model is given
        schema:
          type: string
          enum:
          - chat
          - embedding
          - completion
          - rerank
          - image_generation
          - audio_transcription
          - audio_speech
          - realtime
          - moderation
          example: chat
      - name: min_context
        in: query
        required: false
        description: Minimum context window (max input tokens)
        schema:
          type: integer
          minimum: 1
          maximum: 100000000
          example: 100000
      - name: capabilities
        in: query
        required: false
        description: 'Comma-separated required capabilities: vision, function_calling, reasoning, prompt_caching, response_schema, pdf_input, audio_input, audio_output, web_search, computer_use, video_input'
        schema:
          type: string
          maxLength: 200
          example: vision
      - name: limit
        in: query
        required: false
        description: Max rows per model or in the ranking (default 10)
        schema:
          type: integer
          minimum: 1
          maximum: 25
          example: 5
      - name: include_deprecated
        in: query
        required: false
        description: Include models past their deprecation date in the cheapest search (default false)
        schema:
          type: string
          enum:
          - 'true'
          - 'false'
          example: 'false'
      responses:
        '200':
          description: OK (payment settled). Example is a trimmed real output.
          content:
            application/json:
              schema:
                type: object
                properties:
                  as_of:
                    type: string
                  source:
                    type: object
                    properties:
                      name:
                        type: string
                      commit:
                        type: string
                      committed_at:
                        type: string
                      url:
                        type: string
                      license:
                        type: string
                      models_in_table:
                        type: integer
                  kind:
                    type: string
                  query:
                    type: object
                    properties:
                      model:
                        type:
                        - array
                        - 'null'
                        items:
                          type: string
                      input_tokens:
                        type:
                        - integer
                        - 'null'
                      output_tokens:
                        type:
                        - integer
                        - 'null'
                      requests:
                        type: integer
                      provider:
                        type:
                        - string
                        - 'null'
                      mode:
                        type: string
                      min_context:
                        type:
                        - integer
                        - 'null'
                      capabilities:
                        type: array
                        items:
                          type: string
                      limit:
                        type: integer
                      include_deprecated:
                        type: boolean
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        query:
                          type: string
                        exact_match:
                          type: boolean
                        listings_total:
                          type: integer
                        listings:
                          type: array
                          items:
                            type: object
                            properties:
                              model:
                                type: string
                              provider:
                                type: string
                              mode:
                                type: string
                              input_per_1m_usd:
                                type:
                                - number
                                - 'null'
                              output_per_1m_usd:
                                type:
                                - number
                                - 'null'
                              cached_input_per_1m_usd:
                                type:
                                - number
                                - 'null'
                              batch_input_per_1m_usd:
                                type:
                                - number
                                - 'null'
                              batch_output_per_1m_usd:
                                type:
                                - number
                                - 'null'
                              context_window:
                                type:
                                - integer
                                - 'null'
                              max_output_tokens:
                                type:
                                - integer
                                - 'null'
                              capabilities:
                                type: array
                                items:
                                  type: string
                              long_context_tier:
                                type:
                                - object
                                - 'null'
                                properties:
                                  above_input_tokens:
                                    type: integer
                                  input_per_1m_usd:
                                    type:
                                    - number
                                    - 'null'
                                  output_per_1m_usd:
                                    type:
                                    - number
                                    - 'null'
                              deprecation_date:
                                type:
                                - string
                                - 'null'
                              deprecated:
                                type: boolean
                              estimate:
                                type:
                                - object
                                - 'null'
                                properties:
                                  input_tokens:
                                    type: integer
                                  output_tokens:
                                    type: integer
                                  requests:
                                    type: integer
                                  input_cost_usd:
                                    type: number
                                  output_cost_usd:
                                    type: number
                                  cost_per_request_usd:
                                    type: number
                                  total_cost_usd:
                                    type: number
                                  long_context_tier_applied:
                                    type: boolean
                  attribution:
                    type: string
                  ranking:
                    type: string
                  matched_total:
                    type: integer
                  models:
                    type: array
                    items:
                      type: object
                      properties:
                        model:
                          type: string
                        provider:
                          type: string
                        mode:
                          type: string
                        input_per_1m_usd:
                          type:
                          - number
                          - 'null'
                        output_per_1m_usd:
                          type:
                          - number
                          - 'null'
                        cached_input_per_1m_usd:
                          type:
                          - number
                          - 'null'
                        batch_input_per_1m_usd:
                          type:
                          - number
                          - 'null'
                        batch_output_per_1m_usd:
                          type:
                          - number
                          - 'null'
                        context_window:
                          type:
                          - integer
                          - 'null'
                        max_output_tokens:
                          type:
                          - integer
                          - 'null'
                        capabilities:
                          type: array
                          items:
                            type: string
                        long_context_tier:
                          type:
                          - object
                          - 'null'
                          properties:
                            above_input_tokens:
                              type: integer
                            input_per_1m_usd:
                              type:
                              - number
                              - 'null'
                            output_per_1m_usd:
                              type:
                              - number
                              - 'null'
                        deprecation_date:
                          type:
                          - string
                          - 'null'
                        deprecated:
                          type: boolean
                        estimate:
                          type:
                          - object
                          - 'null'
                          properties:
                            input_tokens:
                              type: integer
                            output_tokens:
                              type: integer
                            requests:
                              type: integer
                            input_cost_usd:
                              type: number
                            output_cost_usd:
                              type: number
                            cost_per_request_usd:
                              type: number
                            total_cost_usd:
                              type: number
                            long_context_tier_applied:
                              type: boolean
                required:
                - as_of
                - source
                - kind
                - query
                - attribution
              example:
                as_of: '2026-10-18'
                source:
                  name: LiteLLM model_prices_and_context_window.json
                  commit: af194c842cd8c0276f69fc05efacaa18505c7484
                  committed_at: '2026-10-18T02:54:27Z'
                  url: https://github.com/BerriAI/litellm/blob/af194c842cd8c0276f69fc05efacaa18505c7484/model_prices_and_context_window.json
                  license: MIT
                  models_in_table: 3418
                kind: lookup
                query:
                  model:
                  - gpt-4o
                  input_tokens: 12000
                  output_tokens: 800
                  requests: 1000
                  provider: null
                  mode: chat
                  min_context: null
                  capabilities: []
                  limit: 3
                  include_deprecated: false
                results:
                - query: gpt-4o
                  exact_match: true
                  listings_total: 5
                  listings:
                  - model: gpt-4o
                    provider: openai
                    mode: chat
                    input_per_1m_usd: 2.5
                    output_per_1m_usd: 10
                    cached_input_per_1m_usd: 1.25
                    batch_input_per_1m_usd: 1.25
                    batch_output_per_1m_usd: 5
                    context_window: 128000
                    max_output_tokens: 16384
                    capabilities:
                    - vision
                    long_context_tier: null
                    deprecation_date: null
                    deprecated: false
                    estimate:
                      input_tokens: 12000
                      output_tokens: 800
                      requests: 1000
                      input_cost_usd: 30
                      output_cost_usd: 8
                      cost_per_request_usd: 0.038
                      total_cost_usd: 38
                      long_context_tier_applied: false
                attribution: 'Prices: LiteLLM model_prices_and_context_window.json, MIT License, Copyright (c) 2023 Berri AI. List prices as compiled by LiteLLM; confirm with the provider b…'
        '400':
          description: Invalid or missing parameters, or URL/domain not allowed (validated before payment where possible; not charged)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine-readable error code, e.g. bad_request, not_found, upstream_error, upstream_unreachable, upstream_not_configured
                    examples:
                    - bad_request
                  message:
                    type: string
                    description: Human-readable explanation
                    examples:
                    - month must be YYYYMM (e.g. 202409)
                required:
                - error
        '402':
          description: Payment Required (x402 v2). Returned for every unpaid request. PAYMENT-REQUIRED response header carries base64 JSON PaymentRequired; retry with PAYMENT-SIGNATURE.
        '500':
          description: Unexpected server error (not charged)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine-readable error code, e.g. bad_request, not_found, upstream_error, upstream_unreachable, upstream_not_configured
                    examples:
                    - bad_request
                  message:
                    type: string
                    description: Human-readable explanation
                    examples:
                    - month must be YYYYMM (e.g. 202409)
                required:
                - error
        '503':
          description: Endpoint temporarily disabled or upstream not configured on this server; no 402 is issued (not charged). Check /status, retry later
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Machine-readable error code, e.g. bad_request, not_found, upstream_error, upstream_unreachable, upstream_not_configured
                    examples:
                    - bad_request
                  message:
                    type: string
                    description: Human-readable explanation
                    examples:
                    - month must be YYYYMM (e.g. 202409)
                required:
                - error
      tags:
      - AI
x-x402-network: eip155:8453
x-billing-policy: 'No charge on failure: payment is settled only after the endpoint returns a 2xx response. Any 4xx or 5xx (bad input, no data, upstream error, timeout, disabled endpoint) is not settled, so the signed payment is never collected. Input is validated before the 402 wherever possible. Over MCP, a tool result with isError is not settled either.'
x-error-codes:
- status: 400
  codes:
  - bad_request
  - url_not_allowed
  - bad_checksum
  - not_a_contract
  meaning: Invalid or missing parameters, or a URL/domain that is not allowed.
  retry: Fix the input; do not retry as is.
- status: 402
  codes: []
  meaning: Payment required (x402 v2). The PAYMENT-REQUIRED header holds the exact price.
  retry: Pay with an x402 client and retry with PAYMENT-SIGNATURE.
- status: 403
  codes:
  - not_bok_authored
  meaning: Requested table/resource is not served (e.g. statistics not authored by the Bank of Korea).
  retry: Do not retry.
- status: 404
  codes:
  - not_found
  - tx_not_found
  - tx_not_mined
  meaning: No data for the requested period/code yet.
  retry: Try an earlier period or another code.
- status: 413
  codes:
  - too_large
  meaning: Document is larger than this server's conversion cap (checked before payment).
  retry: Send a smaller document.
- status: 415
  codes:
  - unsupported_type
  - type_mismatch
  meaning: Document type not supported or not matching the declared type (before payment).
  retry: Do not retry as is.
- status: 502
  codes:
  - upstream_error
  - upstream_bad_response
  - upstream_http_error
  - rpc_unavailable
  - source_http_error
  meaning: The upstream source (government API, RPC, target site) returned an error or unreadable data.
  retry: Retry after 30-60 s with backoff.
- status: 503
  codes:
  - endpoint_disabled
  - upstream_not_configured
  - payment_not_configured
  meaning: Endpoint temporarily disabled on this server, or its upstream is not configured. No 402 is issued.
  retry: Check /status; retry later.
- status: 504
  codes:
  - upstream_unreachable
  meaning: The upstream source timed out or was unreachable (Korean public data APIs have occasional outages, esp. holidays).
  retry: Retry after 1-5 min with backoff.