FREE AI INDEX / 统一产品界面我的收藏提交资源 ↗

Free AI Index / 从零开始Getting started / NVIDIA NIM

FIRST API CALL / nvidia-nim

NVIDIA NIM:跑通第一次 API 调用Make your first NVIDIA NIM API call

先确认注册与免费条件,再按步骤获取密钥、安装依赖并验证返回结果。教程只使用环境变量读取密钥。Check signup and free terms first, then create a key, install dependencies and validate the response. Examples read credentials from environment variables.

官方文档复核Official docs reviewed: 2026-10-07独立 API 实测Independent API test: 尚未记录Not recorded

注册与网络前提Signup and network requirements

网络 / 地区
托管 API 需能访问 integrate.api.nvidia.com;大陆账号与网络支持情况未由本教程实测。
账号
NVIDIA Developer 账号和 API Key;选择带 Free Endpoint 标签的模型。
手机号
官方托管 API 文档未说明统一手机号要求;以账号注册页面提示为准。
实名认证
官方托管 API 文档未说明统一实名认证要求;以账号注册页面提示为准。
信用卡 / 付款方式
只有目录中标注 Free Endpoint 的模型可按当前免费条件试用;绑卡要求未从 API 文档确认。

这些条件会因账号、地区和产品计划而变化。标注“待核验”表示 FreeLLM 尚未从当前链接的官方资料确认;不要据此推断为不需要。These requirements can vary by account, region and plan. “Unverified” means FreeLLM has not confirmed the condition from the linked official sources; it does not mean the requirement is absent.

获取并安全设置 API KeyGet and safely set your API key

在终端设置密钥Set the key in your terminal

以下命令只为当前终端会话设置环境变量。请在自己的电脑上把尖括号内容替换成真实密钥,不要把密钥发给 FreeLLM 或粘贴到公开代码。These commands set a variable for the current terminal session. Replace the angle-bracket text with your key on your own device; never send it to FreeLLM or commit it to source code.

Windows PowerShellWindows PowerShell

$env:NVIDIA_API_KEY = "<在此粘贴本地 API Key>"

macOS / LinuxmacOS / Linux

export NVIDIA_API_KEY="<在此粘贴本地 API Key>"

FreeLLM 资源记录FreeLLM resource records

详细操作步骤Detailed operation paths

每条路径都拆成前置条件、步骤、可复制命令和验证动作;免费条件仍以官方页面实时状态为准。curl 命令按 macOS / Linux shell 编写,Windows 用户可使用同页的 Python 或 Node.js 示例。Each path includes prerequisites, steps, copyable commands and a validation action; free terms still follow the provider's live official policy. The curl examples use a macOS/Linux shell; Windows users can run the Python or Node.js examples on this page.

调用 NVIDIA API Catalog Free Endpoint

api

EndpointEndpoint
https://integrate.api.nvidia.com/v1
认证Authentication
Authorization: Bearer NVIDIA API key
额度与限制Limits

Dynamic by model, use-case and service load; official public docs do not publish one universal free-tier RPM/credits value.

前置条件Prerequisites

  • NVIDIA accountNVIDIA account
  • Free NVIDIA Developer ProgramFree NVIDIA Developer Program
  • NVIDIA API KeyNVIDIA API Key

操作步骤Steps

  1. 筛选 Free Endpoint

    打开 build.nvidia.com/models,使用 Free Endpoint 过滤器确认目标模型仍为免费云端 endpoint。

  2. 生成 API Key

    登录后在目标模型 Integrate 页面或账户设置生成 API Key。

  3. 复制当前集成代码

    直接复制目标模型页面给出的 endpoint / model ID / SDK 示例,避免手工猜测不同 NIM 的路径。

  4. 小流量验证

    先发最小请求并观察 429 / rate-limit 响应;开发者免费层的限流会动态变化。

  5. Python SDK 示例

    安装 OpenAI SDK;在运行环境设置 NVIDIA_API_KEY,示例代码通过环境变量读取密钥。

    可复制命令Copyable command
    python -m pip install -U openai
    
    import os
    from openai import OpenAI
    
    client = OpenAI(
        api_key=os.environ["NVIDIA_API_KEY"],
        base_url="https://integrate.api.nvidia.com/v1",
    )
    response = client.chat.completions.create(
        model="openai/gpt-oss-20b",
        messages=[{"role": "user", "content": "用一句话解释 API 是什么。"}],
        max_tokens=256,
    )
    print(response.choices[0].message.content)

    预期结果Expected:终端打印模型生成的回复;再到提供商控制台确认请求状态和额度扣减。

  6. Node.js SDK 示例

    安装 OpenAI SDK;在运行环境设置 NVIDIA_API_KEY,示例代码通过环境变量读取密钥。

    可复制命令Copyable command
    npm install openai
    
    import OpenAI from "openai";
    
    const client = new OpenAI({
      apiKey: process.env.NVIDIA_API_KEY,
      baseURL: "https://integrate.api.nvidia.com/v1",
    });
    const response = await client.chat.completions.create({
      model: "openai/gpt-oss-20b",
      messages: [{ role: "user", content: "用一句话解释 API 是什么。" }],
      max_tokens: 256,
    });
    console.log(response.choices[0].message.content);

    预期结果Expected:Node.js 打印模型生成的回复;再到提供商控制台确认请求状态和额度扣减。

验证动作Validation

目标模型页面仍标 Free Endpoint,API 请求成功;若标签消失或 endpoint 变化,则停止按免费入口宣传。

常见问题Common issues
  • 不要把论坛里的 1,000 credits / 40 RPM 当统一官方规则。1,000 credits / 40 RPM 。
  • Free Endpoint 列表会变。Free Endpoint 。
  • self-host NIM 与 NVIDIA-hosted free endpoint 是两条不同路径。self-host NIM NVIDIA-hosted free endpoint 。

官方来源Official sources