지식 기반 섹션 ▾

도구

API 빠른 시작 — curl, Python, TypeScript

JoinGonka GatewayGonka 분산형 네트워크에 대한 OpenAI + Anthropic 호환 API를 제공합니다. OpenAI API(/v1/chat/completions)용으로 작성된 모든 코드는 Gonka에서 작동하며, base_urlapi_key만 변경하면 됩니다. Anthropic API(Claude Code) 도구는 /v1/messages를 통해 프록시 없이 직접 연결됩니다.

이 문서에서는 세 가지 가장 인기 있는 도구(curl(명령줄), Python, TypeScript/Node.js(OpenAI 형식))에 대한 준비된 코드 예제를 제공합니다. Anthropic 형식에 대해서는 Claude Code 지침을 참조하십시오.

필요한 것: JoinGonka API 키(jg-xxx 형식). gate.joingonka.ai/register에서 1천만 토큰 보너스와 함께 무료로 받으세요.

curl — 터미널에서 요청

API 작동을 확인하는 가장 빠른 방법은 curl입니다.

일반 요청:

curl https://gate.joingonka.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer jg-당신의_키" \
  -d '{
    "model": "Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",
    "messages": [
      {"role": "user", "content": "Gonka는 무엇입니까?"}
    ]
  }'

스트리밍 (부분적인 응답):

curl https://gate.joingonka.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer jg-당신의_키" \
  -d '{
    "model": "Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",
    "messages": [
      {"role": "user", "content": "Python으로 'hello world'를 작성해 주세요"}
    ],
    "stream": true
  }'

응답은 JSON 형식 (일반) 또는 Server-Sent Events (스트리밍)으로 제공되며, OpenAI API와 완전히 호환됩니다.

Python — openai SDK

공식 OpenAI Python SDK는 JoinGonka Gateway와 변경 없이 작동합니다.

pip install openai

일반 요청:

from openai import OpenAI

client = OpenAI(
    base_url="https://gate.joingonka.ai/v1",
    api_key="jg-당신의_키",
)

response = client.chat.completions.create(
    model="Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",
    messages=[
        {"role": "user", "content": "블록체인을 쉽게 설명해 주세요"}
    ],
)

print(response.choices[0].message.content)

스트리밍:

stream = client.chat.completions.create(
    model="Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",
    messages=[{"role": "user", "content": "Python으로 정렬 알고리즘을 작성해 주세요"}],
    stream=True,
)

for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

도구 호출:

import json

tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "도시의 날씨를 얻는 함수",
        "parameters": {
            "type": "object",
            "properties": {
                "city": {"type": "string", "description": "도시 이름"}
            },
            "required": ["city"]
        }
    }
}]

response = client.chat.completions.create(
    model="Qwen/Qwen3-235B-A22B-Instruct-2507-FP8",
    messages=[{"role": "user", "content": "모스크바 날씨는 어때요?"}],
    tools=tools,
)

tool_call = response.choices[0].message.tool_calls[0]
print(f"함수: {tool_call.function.name}")
print(f"인수: {tool_call.function.arguments}")

Qwen3-235B는 네이티브 툴 호출을 지원하며, 함수는 텍스트 응답을 파싱하지 않고 올바르게 호출됩니다.

TypeScript/Node.js — openai SDK

설치:

npm install openai

일반 요청:

import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://gate.joingonka.ai/v1',
  apiKey: 'jg-당신의_키',
});

async function main() {
  const response = await client.chat.completions.create({
    model: 'Qwen/Qwen3-235B-A22B-Instruct-2507-FP8',
    messages: [
      { role: 'user', content: 'Express.js 서버를 작성해 주세요' },
    ],
  });

  console.log(response.choices[0].message.content);
}

main();

스트리밍:

const stream = await client.chat.completions.create({
  model: 'Qwen/Qwen3-235B-A22B-Instruct-2507-FP8',
  messages: [{ role: 'user', content: 'async/await를 설명해 주세요' }],
  stream: true,
});

for await (const chunk of stream) {
  const content = chunk.choices[0]?.delta?.content || '';
  process.stdout.write(content);
}

도구 호출:

const response = await client.chat.completions.create({
  model: 'Qwen/Qwen3-235B-A22B-Instruct-2507-FP8',
  messages: [{ role: 'user', content: '100 USD를 EUR로 변환해 주세요' }],
  tools: [{
    type: 'function',
    function: {
      name: 'convert_currency',
      description: '통화 변환',
      parameters: {
        type: 'object',
        properties: {
          amount: { type: 'number' },
          from: { type: 'string' },
          to: { type: 'string' },
        },
        required: ['amount', 'from', 'to'],
      },
    },
  }],
});

const toolCall = response.choices[0].message.tool_calls?.[0];
console.log(`함수: ${toolCall?.function.name}`);
console.log(`인수: ${toolCall?.function.arguments}`);

모든 예시는 공식 OpenAI SDK를 사용하며, 추가 라이브러리는 필요하지 않습니다. base_urlapi_key만 변경하면 됩니다.

지원되는 API 매개변수

JoinGonka Gateway는 모든 표준 OpenAI Chat Completions API 매개변수를 지원합니다:

매개변수유형설명
modelstring모델: Qwen/Qwen3-235B-A22B-Instruct-2507-FP8
messagesarray메시지 기록 (system, user, assistant)
streamboolean스트리밍 생성 (SSE). 기본값: false
temperaturenumber응답의 창의성 (0.0 — 2.0)
max_tokensinteger응답의 최대 길이 (최대: 2048, 기본값: 1024)
toolsarray도구 호출을 위한 함수 정의
tool_choicestring/object함수 호출 전략

Qwen3-235B 모델 매개변수: 컨텍스트 창은 128K 토큰, 최대 응답은 2048 토큰입니다. 전체 사양: HuggingFace. 모델 목록은 GET /v1/models를 통해 사용할 수 있습니다.

두 가지 엔드포인트:

  • OpenAI 형식: POST https://gate.joingonka.ai/v1/chat/completions
  • Anthropic 형식: POST https://gate.joingonka.ai/v1/messages

인증: Authorization: Bearer jg-귀하의-키 (OpenAI) 또는 x-api-key: jg-귀하의-키 (Anthropic)

응답 형식은 OpenAI 및 Anthropic과 완벽하게 호환됩니다. OpenAI 또는 Anthropic API를 지원하는 모든 SDK, 라이브러리 또는 프레임워크는 수정 없이 JoinGonka Gateway와 함께 작동합니다. Claude Code는 Anthropic 형식을 통해 직접 연결됩니다.

JoinGonka Gateway — 0.001달러/1M 토큰의 OpenAI + Anthropic 호환 API. curl, Python, TypeScript — 3줄의 코드. 스트리밍, 도구 호출, 모든 OpenAI + Anthropic API 매개변수. Claude Code는 /v1/messages를 통해 직접 작동합니다. 시작 시 1천만 무료 토큰.

더 자세히 알고 싶으세요?

다른 섹션을 탐색하거나 지금 GNK를 얻기 시작하세요.

무료 10M 토큰 받기 →