빠른 시작
최종 수정 2026-10-05
OpenAI SDK로 Aston AI Gateway를 통해 모델을 호출하고 실시간 센싱 데이터를 읽게 해 보세요. 약 5분이면 됩니다.
API는 설계 초안이며 정식 문서가 우선합니다. AI Gateway 베타는 2027년 1분기 공개 예정입니다.
1
로그인 후 계정 메뉴에서 'API 키'를 열고 키를 만드세요.
2
OpenAI SDK를 설치하세요: pip install openai 또는 npm install openai.
3
base_url을 https://api.aston.ai/v1로 바꾸고 첫 요청을 보내세요.
4
aston 필드에 허용할 Sense Tools를 나열하고 이번 요청의 DC 한도를 정하세요.
Python
from openai import OpenAI
client = OpenAI(base_url='https://api.aston.ai/v1', api_key='ASTON_API_KEY')
resp = client.chat.completions.create(
model='deepseek/deepseek-chat',
messages=[{'role': 'user', 'content': 'Is now a good time to run near Marina Bay, Singapore?'}],
extra_body={'aston': {
'sense_tools': ['air_quality', 'noise', 'micro_weather'],
'max_dc': 200, # tool budget for this request: 200 DC = $0.02
}},
)
print(resp.choices[0].message.content)Node.js
import OpenAI from 'openai';
const client = new OpenAI({ baseURL: 'https://api.aston.ai/v1', apiKey: process.env.ASTON_API_KEY });
const resp = await client.chat.completions.create({
model: 'deepseek/deepseek-chat',
messages: [{ role: 'user', content: 'Is now a good time to run near Marina Bay, Singapore?' }],
aston: { sense_tools: ['air_quality', 'noise'], max_dc: 200 }, // Aston extension field
});
console.log(resp.choices[0].message.content);cURL
curl https://api.aston.ai/v1/chat/completions \
-H "Authorization: Bearer $ASTON_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek/deepseek-chat", "messages": [{"role": "user", "content": "Is now a good time to run near Marina Bay?"}], "aston": {"sense_tools": ["air_quality"], "max_dc": 200}}'이 페이지가 도움이 되었나요?