OpenRouter · Capability

OpenRouter API

OpenRouter provides unified access to hundreds of AI models through a single API endpoint. It implements the OpenAI API specification for chat completions, allowing developers to use any model with the same request and response format. The API also exposes model discovery, generation statistics, credits and balance information, and provisioning endpoints for programmatic key management.

Run with Naftiko OpenrouterAPI

What You Can Do

POST
Createchatcompletion — Create chat completion
/chat/completions
POST
Createcompletion — Create completion
/completions
GET
Listmodels — List available models
/models
GET
Listmodelendpoints — List endpoints for a model
/models/{author}/{slug}/endpoints
GET
Getgeneration — Get generation stats
/generation
GET
Getcredits — Get credit balance
/credits
GET
Listproviders — List providers
/providers
GET
Listkeys — List API keys
/keys
POST
Createkey — Create API key
/keys
GET
Getkey — Get API key
/keys/{hash}
DELETE
Deletekey — Delete API key
/keys/{hash}
PATCH
Updatekey — Update API key
/keys/{hash}

MCP Tools

createchatcompletion

Create chat completion

createcompletion

Create completion

listmodels

List available models

read-only idempotent
listmodelendpoints

List endpoints for a model

read-only idempotent
getgeneration

Get generation stats

read-only idempotent
getcredits

Get credit balance

read-only idempotent
listproviders

List providers

read-only idempotent
listkeys

List API keys

read-only idempotent
createkey

Create API key

getkey

Get API key

read-only idempotent
deletekey

Delete API key

idempotent
updatekey

Update API key

Capability Spec

openrouter-capability.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: OpenRouter API
  description: OpenRouter provides unified access to hundreds of AI models through a single API endpoint. It implements the
    OpenAI API specification for chat completions, allowing developers to use any model with the same request and response
    format. The API also exposes model discovery, generation statistics, credits and balance information, and provisioning
    endpoints for programmatic key management.
  tags:
  - Openrouter
  - API
  created: '2026-05-06'
  modified: '2026-05-06'
capability:
  consumes:
  - type: http
    namespace: openrouter
    baseUri: https://openrouter.ai/api/v1
    description: OpenRouter API HTTP API.
    authentication:
      type: bearer
      token: '{{OPENROUTER_TOKEN}}'
    resources:
    - name: chat-completions
      path: /chat/completions
      operations:
      - name: createchatcompletion
        method: POST
        description: Create chat completion
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: completions
      path: /completions
      operations:
      - name: createcompletion
        method: POST
        description: Create completion
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: models
      path: /models
      operations:
      - name: listmodels
        method: GET
        description: List available models
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: models-author-slug-endpoints
      path: /models/{author}/{slug}/endpoints
      operations:
      - name: listmodelendpoints
        method: GET
        description: List endpoints for a model
        inputParameters:
        - name: author
          in: path
          type: string
          required: true
        - name: slug
          in: path
          type: string
          required: true
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: generation
      path: /generation
      operations:
      - name: getgeneration
        method: GET
        description: Get generation stats
        inputParameters:
        - name: id
          in: query
          type: string
          required: true
          description: Generation identifier returned in chat completion responses.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: credits
      path: /credits
      operations:
      - name: getcredits
        method: GET
        description: Get credit balance
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: providers
      path: /providers
      operations:
      - name: listproviders
        method: GET
        description: List providers
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: keys
      path: /keys
      operations:
      - name: listkeys
        method: GET
        description: List API keys
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: createkey
        method: POST
        description: Create API key
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: keys-hash
      path: /keys/{hash}
      operations:
      - name: getkey
        method: GET
        description: Get API key
        inputParameters:
        - name: hash
          in: path
          type: string
          required: true
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: deletekey
        method: DELETE
        description: Delete API key
        inputParameters:
        - name: hash
          in: path
          type: string
          required: true
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: updatekey
        method: PATCH
        description: Update API key
        inputParameters:
        - name: hash
          in: path
          type: string
          required: true
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
  exposes:
  - type: rest
    port: 8080
    namespace: openrouter-rest
    description: REST adapter for OpenRouter API.
    resources:
    - path: /chat/completions
      name: createchatcompletion
      operations:
      - method: POST
        name: createchatcompletion
        description: Create chat completion
        call: openrouter.createchatcompletion
        outputParameters:
        - type: object
          mapping: $.
    - path: /completions
      name: createcompletion
      operations:
      - method: POST
        name: createcompletion
        description: Create completion
        call: openrouter.createcompletion
        outputParameters:
        - type: object
          mapping: $.
    - path: /models
      name: listmodels
      operations:
      - method: GET
        name: listmodels
        description: List available models
        call: openrouter.listmodels
        outputParameters:
        - type: object
          mapping: $.
    - path: /models/{author}/{slug}/endpoints
      name: listmodelendpoints
      operations:
      - method: GET
        name: listmodelendpoints
        description: List endpoints for a model
        call: openrouter.listmodelendpoints
        with:
          author: rest.author
          slug: rest.slug
        outputParameters:
        - type: object
          mapping: $.
    - path: /generation
      name: getgeneration
      operations:
      - method: GET
        name: getgeneration
        description: Get generation stats
        call: openrouter.getgeneration
        outputParameters:
        - type: object
          mapping: $.
    - path: /credits
      name: getcredits
      operations:
      - method: GET
        name: getcredits
        description: Get credit balance
        call: openrouter.getcredits
        outputParameters:
        - type: object
          mapping: $.
    - path: /providers
      name: listproviders
      operations:
      - method: GET
        name: listproviders
        description: List providers
        call: openrouter.listproviders
        outputParameters:
        - type: object
          mapping: $.
    - path: /keys
      name: listkeys
      operations:
      - method: GET
        name: listkeys
        description: List API keys
        call: openrouter.listkeys
        outputParameters:
        - type: object
          mapping: $.
    - path: /keys
      name: createkey
      operations:
      - method: POST
        name: createkey
        description: Create API key
        call: openrouter.createkey
        outputParameters:
        - type: object
          mapping: $.
    - path: /keys/{hash}
      name: getkey
      operations:
      - method: GET
        name: getkey
        description: Get API key
        call: openrouter.getkey
        with:
          hash: rest.hash
        outputParameters:
        - type: object
          mapping: $.
    - path: /keys/{hash}
      name: deletekey
      operations:
      - method: DELETE
        name: deletekey
        description: Delete API key
        call: openrouter.deletekey
        with:
          hash: rest.hash
        outputParameters:
        - type: object
          mapping: $.
    - path: /keys/{hash}
      name: updatekey
      operations:
      - method: PATCH
        name: updatekey
        description: Update API key
        call: openrouter.updatekey
        with:
          hash: rest.hash
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    port: 9090
    namespace: openrouter-mcp
    transport: http
    description: MCP adapter for OpenRouter API for AI agent use.
    tools:
    - name: createchatcompletion
      description: Create chat completion
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: openrouter.createchatcompletion
      outputParameters:
      - type: object
        mapping: $.
    - name: createcompletion
      description: Create completion
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: openrouter.createcompletion
      outputParameters:
      - type: object
        mapping: $.
    - name: listmodels
      description: List available models
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openrouter.listmodels
      outputParameters:
      - type: object
        mapping: $.
    - name: listmodelendpoints
      description: List endpoints for a model
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openrouter.listmodelendpoints
      with:
        author: tools.author
        slug: tools.slug
      inputParameters:
      - name: author
        type: string
        description: author
        required: true
      - name: slug
        type: string
        description: slug
        required: true
      outputParameters:
      - type: object
        mapping: $.
    - name: getgeneration
      description: Get generation stats
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openrouter.getgeneration
      with:
        id: tools.id
      inputParameters:
      - name: id
        type: string
        description: Generation identifier returned in chat completion responses.
        required: true
      outputParameters:
      - type: object
        mapping: $.
    - name: getcredits
      description: Get credit balance
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openrouter.getcredits
      outputParameters:
      - type: object
        mapping: $.
    - name: listproviders
      description: List providers
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openrouter.listproviders
      outputParameters:
      - type: object
        mapping: $.
    - name: listkeys
      description: List API keys
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openrouter.listkeys
      outputParameters:
      - type: object
        mapping: $.
    - name: createkey
      description: Create API key
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: openrouter.createkey
      outputParameters:
      - type: object
        mapping: $.
    - name: getkey
      description: Get API key
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: openrouter.getkey
      with:
        hash: tools.hash
      inputParameters:
      - name: hash
        type: string
        description: hash
        required: true
      outputParameters:
      - type: object
        mapping: $.
    - name: deletekey
      description: Delete API key
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: openrouter.deletekey
      with:
        hash: tools.hash
      inputParameters:
      - name: hash
        type: string
        description: hash
        required: true
      outputParameters:
      - type: object
        mapping: $.
    - name: updatekey
      description: Update API key
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: openrouter.updatekey
      with:
        hash: tools.hash
      inputParameters:
      - name: hash
        type: string
        description: hash
        required: true
      outputParameters:
      - type: object
        mapping: $.
binds:
- namespace: env
  keys:
    OPENROUTER_TOKEN: OPENROUTER_TOKEN