한국어
문서
Console
Console API
프로바이더 API

프로바이더 API

Console 키를 사용해 Console 게이트웨이를 통해 워크스페이스에 연결된 프로바이더를 호출합니다.

워크스페이스에 연결된 모든 프로바이더는 Console 게이트웨이에서 고유한 URL로 제공됩니다. OpenCode는 /connect 이후 이를 자동으로 사용하며, 자체 도구에서 동일한 프로바이더를 사용하려면 직접 호출할 수 있습니다. Console이 요청을 전달하기 전에 프로바이더 자격 증명을 추가하므로 프로바이더 시크릿은 워크스페이스 외부로 유출되지 않습니다.

curl -X POST "https://opencode.ai/inference/custom/conn_.../chat/completions" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [{ "role": "user", "content": "Say hi" }]
  }'

프로바이더 URL

Providers 아래의 해당 프로바이더 페이지에서 Console API URL을 복사합니다.

https://opencode.ai/inference/custom/<connection_id>

인증

<token>을 Console에서 생성한 서비스 계정 키로 바꾸세요. Console은 요청을 전달하기 전에 이를 해당 연결의 자격 증명으로 교체합니다.

Authorization: Bearer <token>

Console은 x-api-key, api-key 또는 x-goog-api-key에서도 키를 읽으므로, 프로바이더 SDK가 Console API URL을 가리키도록 설정하면 그대로 작동합니다.

엔드포인트

Console API URL 뒤에 프로바이더의 API 경로를 붙이세요. Console은 연결의 기본 URL로 요청을 전달하고 프로바이더 응답을 변경 없이 반환합니다.

형식경로
Chat Completions/chat/completions
Responses API/responses
Anthropic Compatible/messages
Google Generative AI/models/<model>:generateContent
Embeddings/embeddings

프로바이더 페이지에 표시된 그대로 모델 ID를 전송하세요. 업스트림에 다른 API ID가 있는 모델의 경우 Console이 이를 다시 작성합니다. 연결에서 활성화되지 않은 모델에 대한 요청은 거부됩니다.

Chat Completions

curl -X POST "https://opencode.ai/inference/custom/conn_.../chat/completions" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [{ "role": "user", "content": "Say hi" }]
  }'

Responses API

curl -X POST "https://opencode.ai/inference/custom/conn_.../responses" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6.1-sol",
    "input": "Say hi"
  }'

Anthropic Compatible

max_tokens가 필수입니다.

curl -X POST "https://opencode.ai/inference/custom/conn_.../messages" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "max_tokens": 1024,
    "messages": [{ "role": "user", "content": "Say hi" }]
  }'

Google Generative AI

모델과 메서드가 경로에 포함됩니다. 응답을 스트리밍하려면 :generateContent를 :streamGenerateContent로 바꾸세요.

curl -X POST "https://opencode.ai/inference/custom/conn_.../models/gemini-4-argon:generateContent" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{ "parts": [{ "text": "Say hi" }] }]
  }'

사용량

요청은 각 모델에 설정된 가격을 기준으로 예산에 집계됩니다. 토큰 비용은 해당 프로바이더가 청구합니다.