# OpenAPI / Swagger Spec (AI1NET)

{% code overflow="wrap" %}

```yaml
openapi: 3.0.3
info:
  title: AI1NET API
  description: Unified AI Network API for multi-model access
  version: 1.0.0

servers:
  - url: https://api.ai1net.io

security:
  - ApiKeyAuth: []

paths:

  /v1/ai/request:
    post:
      summary: Send AI request
      tags: [AI]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [task, input]
              properties:
                model:
                  type: string
                  example: auto
                task:
                  type: string
                  example: text-generation
                input:
                  type: string
                  example: Write a startup pitch
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  output:
                    type: string
                  model_used:
                    type: string
                  cost:
                    type: number

  /v1/models:
    get:
      summary: Get available AI models
      tags: [Models]
      responses:
        "200":
          description: List of models
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    type:
                      type: string

  /v1/usage:
    get:
      summary: Get usage stats
      tags: [Billing]
      responses:
        "200":
          description: Usage data
          content:
            application/json:
              schema:
                type: object
                properties:
                  requests:
                    type: number
                  cost:
                    type: number

  /v1/routing:
    get:
      summary: Routing info
      tags: [System]
      responses:
        "200":
          description: Routing strategy
          content:
            application/json:
              schema:
                type: object
                properties:
                  strategy:
                    type: string
                    example: cost-optimized

components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ai1net.xyz/for-developers/openapi-swagger-spec-ai1net.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
