> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lithosai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LithosAI APIs

LithosAI 提供兼容 OpenAI 的 API。使用任意 OpenAI 客户端库（例如[官方 OpenAI SDK](https://developers.openai.com/api/docs/libraries?language=python#install-an-official-sdk)）即可调用 LithosAI APIs。

## Base URL

使用 base URL `https://api.lithosai.cloud/v1` 向 LithosAI APIs 发送请求。

## 发送第一个请求

在 [API Key](https://console.lithosai.cloud/keys?lang=zh) 页面创建 API key，把它设为环境变量 `LITHOSAI_API_KEY`，然后运行下面任意一个示例。

<CodeGroup>
  ```python Python theme={null}
  import os

  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["LITHOSAI_API_KEY"],
      base_url="https://api.lithosai.cloud/v1",
  )

  response = client.chat.completions.create(
      model="moonshotai/Kimi-K3",
      messages=[{"role": "user", "content": "Hello"}],
  )
  print(response.choices[0].message.content)
  ```

  ```typescript TypeScript theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.LITHOSAI_API_KEY,
    baseURL: "https://api.lithosai.cloud/v1",
  });

  const response = await client.chat.completions.create({
    model: "moonshotai/Kimi-K3",
    messages: [{ role: "user", content: "Hello" }],
  });
  console.log(response.choices[0].message.content);
  ```

  ```bash curl theme={null}
  curl https://api.lithosai.cloud/v1/chat/completions \
    -H "Authorization: Bearer $LITHOSAI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"model":"moonshotai/Kimi-K3","messages":[{"role":"user","content":"Hello"}]}'
  ```
</CodeGroup>

## 下一步

<CardGroup cols={2}>
  <Card title="认证" icon="key" href="/zh/authentication">
    创建 key，为请求授权。
  </Card>

  <Card title="Chat Completions" icon="message" href="/zh/api-reference/chat/create-a-chat-completion">
    发送提示词，流式接收 token。
  </Card>

  <Card title="Agent 接入" icon="terminal" href="/zh/agent-integrations">
    把常用的编程 Agent 接入 LithosAI 模型。
  </Card>

  <Card title="速率限制" icon="gauge" href="/zh/rate-limits">
    三项每分钟配额，以及怎么解读。
  </Card>

  <Card title="计费" icon="credit-card" href="/zh/billing">
    预付额度、按 token 计价和自动充值。
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.