# Kiota — Generate OpenAPI Clients Anywhere > Kiota is a CLI that generates strongly-typed API clients from any OpenAPI description, so your app doesn’t depend on a different SDK per service. ## Install Copy the content below into your project: ## Quick Use 1. Install Kiota (as .NET global tool): ```bash dotnet tool install --global Microsoft.OpenApi.Kiota ``` 2. Search an OpenAPI source: ```bash kiota search github ``` 3. Generate a client from an OpenAPI URL: ```bash kiota generate --openapi https://contoso.com/api/openapi.yml --language python -o ./client -c MyApiClient -n MyApp.Clients ``` ## Intro Kiota is a CLI that generates strongly-typed API clients from any OpenAPI description, so your app doesn’t depend on a different SDK per service. - **Best for:** platform teams standardizing API clients across multiple services and languages (C#, Python, Java, TS, etc.) - **Works with:** .NET SDK toolchain, OpenAPI descriptions (local files or URLs), codegen + CI workflows - **Setup time:** 10 minutes ## Practical Notes - Supports multiple target languages with varying maturity levels (README table + legend) - Install options include .NET global tool and Homebrew (per official docs) ## Why This Matters for Agents Agents often need to call internal APIs. If each API has a bespoke SDK, your tool surface becomes inconsistent. With OpenAPI-first generation you can: - Produce a consistent client shape across services - Regenerate when schemas change (CI-friendly) - Keep typed request/response models so agents (and humans) can validate inputs earlier Practical workflow: 1. Store OpenAPI specs (or URLs) in your repo. 2. Generate clients into a `generated/` folder. 3. Add a CI check that the generated output is up-to-date. That turns API integration into a repeatable build step instead of a manual “SDK hunt” every time. ### FAQ **Q: Is Kiota tied to one API?** A: No. It generates clients from any OpenAPI-described API. **Q: How do I install it?** A: Official docs show a .NET global tool install and Homebrew as options. **Q: How do I keep generation stable?** A: Pin versions and run generation in CI with a diff check. ## Source & Thanks > Source: https://github.com/microsoft/kiota > License: MIT > GitHub stars: 3,731 · forks: 309 --- ## 快速使用 1. 安装 Kiota(.NET 全局工具): ```bash dotnet tool install --global Microsoft.OpenApi.Kiota ``` 2. 搜索 OpenAPI 源: ```bash kiota search github ``` 3. 从 OpenAPI URL 生成客户端: ```bash kiota generate --openapi https://contoso.com/api/openapi.yml --language python -o ./client -c MyApiClient -n MyApp.Clients ``` ## 简介 Kiota 是一个从 OpenAPI 描述生成强类型客户端的 CLI:用一套生成器覆盖多个服务与多语言,减少“每个 API 一套 SDK”的依赖碎片化,并把 schema 变更转化为可在 CI 中再生成的流程。 - **适合谁:** 需要跨多服务、多语言统一 API 客户端生成方式的平台团队 - **可搭配:** .NET SDK、OpenAPI 描述(文件或 URL)、代码生成与 CI 工作流 - **准备时间:** 10 分钟 ## 实战建议 - 支持多种目标语言且成熟度不同(README 表格 + legend 提示) - 官方文档提供多种安装方式(.NET 全局工具、Homebrew 等) ## 为什么对 Agent 也重要 Agent 经常需要调用内部 API。如果每个服务都有一套风格不同的 SDK,你的工具面会变得非常碎片化。 采用 OpenAPI-first 的生成方式可以: - 跨服务保持一致的 client 形态 - schema 变更时可在 CI 中一键再生成 - 强类型请求/响应模型让输入更早被校验(降低运行时翻车) 推荐工作流: 1. 把 OpenAPI 规范(或 URL)纳入仓库管理; 2. 生成输出到 `generated/`; 3. CI 校验生成结果是否最新(避免漂移)。 这样 API 集成就是可重复的构建步骤,而不是每次都手工“找 SDK/抄请求”。 ### FAQ **Kiota 只能生成某个特定 API 吗?** 答:不是,它针对任何 OpenAPI 描述的 API 都适用。 **怎么安装?** 答:官方文档提供 .NET 全局工具与 Homebrew 等方式。 **怎么保证生成稳定?** 答:固定版本,并在 CI 中运行生成 + diff 校验。 ## 来源与感谢 > Source: https://github.com/microsoft/kiota > License: MIT > GitHub stars: 3,731 · forks: 309 --- Source: https://tokrepo.com/en/workflows/kiota-generate-openapi-clients-anywhere Author: Script Depot