# SDK Repo Structure

📦 `ai1net-sdk-js`

{% code overflow="wrap" %}

```
ai1net-sdk-js/
│
├── src/
│   ├── client.ts
│   ├── types.ts
│   ├── endpoints/
│   │   ├── ai.ts
│   │   ├── models.ts
│   │   ├── usage.ts
│   │   └── routing.ts
│   │
│   ├── utils/
│   │   ├── fetcher.ts
│   │   └── errors.ts
│   │
│   └── index.ts
│
├── package.json
├── tsconfig.json
└── README.md
```

{% endcode %}

***

🔧 Example: `client.ts`

{% code overflow="wrap" %}

```typescript
export class AI1NET {
  private apiKey: string;
  private baseUrl = "https://api.ai1net.io";

  constructor({ apiKey }: { apiKey: string }) {
    this.apiKey = apiKey;
  }

  async request(data: any) {
    const res = await fetch(`${this.baseUrl}/v1/ai/request`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        Authorization: this.apiKey,
      },
      body: JSON.stringify(data),
    });

    return res.json();
  }
}
```

{% endcode %}

***

📦 Usage

{% code overflow="wrap" %}

```typescript
import { AI1NET } from "ai1net-sdk";

const client = new AI1NET({ apiKey: "key" });

const res = await client.request({
  task: "text-generation",
  input: "Explain AI1NET",
});

console.log(res.output);
```

{% 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/sdk-repo-structure.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.
