NanoGPT
NanoGPT
개요 (Overview)
| 속성 | 내용 |
|---|---|
| 설명 | NanoGPT는 요청당 과금(pay-per-prompt)과 구독 기반의 AI 서비스로, 구독이나 회원가입 없이 200개 이상의 강력한 AI 모델에 즉시 접근할 수 있어요. |
| LiteLLM 제공자 라우트 | nano-gpt/ |
| 제공자 문서 링크 | NanoGPT Website ↗ |
| Base URL | https://nano-gpt.com/api/v1 |
| 지원 작업 | /chat/completions, /completions, /embeddings |
NanoGPT란? (What is NanoGPT?)
NanoGPT는 유연한 AI API 서비스로 다음을 제공해요:
- 요청당 과금 (Pay-Per-Prompt Pricing): 구독 없이 사용한 만큼만 지불
- 200개 이상의 AI 모델 (200+ AI Models): 텍스트, 이미지, 비디오 생성 모델에 접근
- 회원가입 불필요 (No Registration Required): 바로 시작 가능
- OpenAI 호환 API (OpenAI-Compatible API): 기존 코드와 손쉽게 통합
- 스트리밍 지원 (Streaming Support): 실시간 응답 스트리밍
- 도구 호출 (Tool Calling): 함수 호출 지원
필요한 변수 (Required Variables)
환경 변수
os.environ["NANOGPT_API_KEY"] = "" # your NanoGPT API key
NanoGPT API 키는 nano-gpt.com에서 받을 수 있어요.
사용법 - LiteLLM Python SDK
비스트리밍 (Non-streaming)
NanoGPT 비스트리밍 Completion
import os
import litellm
from litellm import completion
os.environ["NANOGPT_API_KEY"] = "" # your NanoGPT API key
messages = [{"content": "What is the capital of France?", "role": "user"}]
# NanoGPT call
response = completion(
model="nano-gpt/model-name", # Replace with actual model name
messages=messages
)
print(response)
스트리밍 (Streaming)
NanoGPT 스트리밍 Completion
import os
import litellm
from litellm import completion
os.environ["NANOGPT_API_KEY"] = "" # your NanoGPT API key
messages = [{"content": "Write a short poem about AI", "role": "user"}]
# NanoGPT call with streaming
response = completion(
model="nano-gpt/model-name", # Replace with actual model name
messages=messages,
stream=True
)
for chunk in response:
print(chunk)
도구 호출 (Tool Calling)
NanoGPT 도구 호출
import os
import litellm
os.environ["NANOGPT_API_KEY"] = ""
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string"}
}
}
}
}
]
response = litellm.completion(
model="nano-gpt/model-name",
messages=[{"role": "user", "content": "What's the weather in Paris?"}],
tools=tools
)
사용법 - LiteLLM Proxy Server
1. 환경에 키 저장
export NANOGPT_API_KEY=""
2. 프록시 시작
config.yaml:
model_list:
- model_name: nano-gpt-model
litellm_params:
model: nano-gpt/model-name # Replace with actual model name
api_key: os.environ/NANOGPT_API_KEY
지원 OpenAI 파라미터 (Supported OpenAI Parameters)
NanoGPT는 모든 표준 OpenAI 호환 파라미터를 지원해요:
| 파라미터 | 타입 | 설명 |
|---|---|---|
messages |
array | 필수. 'role'과 'content'를 가진 메시지 객체 배열 |
model |
string | 필수. 200개 이상 모델 중에서 선택한 모델 ID |
stream |
boolean | 선택. 스트리밍 응답 활성화 |
temperature |
float | 선택. 샘플링 온도 |
top_p |
float | 선택. 핵(nucleus) 샘플링 파라미터 |
max_tokens |
integer | 선택. 생성할 최대 토큰 수 |
frequency_penalty |
float | 선택. 빈번한 토큰에 패널티 |
presence_penalty |
float | 선택. 등장 여부 기반 토큰 패널티 |
stop |
string/array | 선택. 중단 시퀀스 |
n |
integer | 선택. 생성할 completion 수 |
tools |
array | 선택. 사용 가능한 도구/함수 목록 |
tool_choice |
string/object | 선택. 도구/함수 호출 제어 |
response_format |
object | 선택. 응답 형식 지정 |
user |
string | 선택. 사용자 식별자 |
모델 카테고리 (Model Categories)
NanoGPT는 여러 모델 카테고리에 접근을 제공해요:
- 텍스트 생성 (Text Generation): 채팅, 완성, 분석용 200개 이상 LLM
- 이미지 생성 (Image Generation): 이미지를 만드는 AI 모델
- 비디오 생성 (Video Generation): 비디오 생성용 AI 모델
- 임베딩 모델 (Embedding Models): 벡터 검색용 텍스트 임베딩 모델
과금 모델 (Pricing Model)
NanoGPT는 유연한 과금 구조를 제공해요:
- 요청당 과금 (Pay-Per-Prompt): 구독 불필요
- 회원가입 불필요 (No Registration): 바로 시작 가능
- 투명한 과금 (Transparent Pricing): 사용한 만큼만 지불
API 문서 (API Documentation)
자세한 API 문서는 docs.nano-gpt.com을 방문해 주세요.
추가 자료 (Additional Resources)
- NanoGPT Website
- NanoGPT API Documentation
- NanoGPT Model List
출처: 문서