📚 API Documentation

Complete API reference for 15code platform

1️⃣ API Overview

Two Protocols Supported

15code supports both OpenAI and Anthropic API protocols. Use OpenAI protocol for GPT/GLM models, Anthropic protocol for Claude models.

Protocol Base URL Supported Models
OpenAI https://cli.15code.com/v1 GPT-5.5 / GPT-5.6, Claude, GLM-5.3, Kimi K3, DeepSeek V4 Pro, Qwen3.8
Anthropic https://claude.15code.com Claude Opus 5.0, Claude Sonnet 5

2️⃣ Authentication

API Key

All requests require API Key authentication. Get your key from Dashboard.

# OpenAI Protocol - Header Authorization: Bearer sk-your-api-key # Anthropic Protocol - Header x-api-key: sk-your-api-key
💡 Security tips:
• Never share your API Key
• Never upload to GitHub or public repos
• Use environment variables instead of hardcoding

3️⃣ Endpoints

OpenAI Protocol Endpoints

Endpoint Method Description
/v1/chat/completions POST Chat completion (main endpoint)
/v1/models GET List available models

Anthropic Protocol Endpoints

Endpoint Method Description
/v1/messages POST Create message (main endpoint)

4️⃣ Request Examples

OpenAI Protocol - curl

curl https://cli.15code.com/v1/chat/completions \ -H "Authorization: Bearer sk-your-api-key" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.6-terra", "messages": [ {"role": "user", "content": "Hello, how are you?"} ], "max_tokens": 1024, "temperature": 0.7 }'

OpenAI Protocol - Python

from openai import OpenAI client = OpenAI( base_url="https://cli.15code.com/v1", api_key="sk-your-api-key" ) response = client.chat.completions.create( model="gpt-5.6-terra", messages=[{"role": "user", "content": "Hello!"}], max_tokens=1024 ) print(response.choices[0].message.content)

Anthropic Protocol - curl

curl https://claude.15code.com/v1/messages \ -H "x-api-key: sk-your-api-key" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-sonnet-4-20250514", "max_tokens": 1024, "messages": [ {"role": "user", "content": "Hello, Claude!"} ] }'

Anthropic Protocol - Python

from anthropic import Anthropic client = Anthropic( base_url="https://claude.15code.com", api_key="sk-your-api-key" ) message = client.messages.create( model="claude-sonnet-4-20250514", max_tokens=1024, messages=[{"role": "user", "content": "Hello!"}] ) print(message.content[0].text)

5️⃣ Supported Models

Claude Series (Anthropic Protocol)

claude-opus-5.0
Flagship · 1M context
claude-sonnet-5
Balanced performance
💡 Claude models:
• claude-opus-5.0 / claude-sonnet-5
• Actual limits follow the selected upstream model

GPT Series (OpenAI Protocol)

gpt-5.6-terra
Recommended default
gpt-5.6-sol
High-quality tasks
gpt-5.6-luna
Fast and economical
gpt-5.5
General high-quality model

GLM Series (OpenAI Protocol)

glm-5.3
Zhipu flagship · $0.80/M input
kimi-k3
Text, vision input and tools follow the catalog
deepseek-v4-pro
Text and tool calling follow the catalog
qwen3.8
Text, search and tools · 64K context
💡 GLM pricing advantage:
• GLM-5.3: $0.80/M input, $0.36/M cache read, $2.40/M output
• Actual availability is determined by /v1/models

Image generation and editing

gpt-image-2
Image generation / editing through Images API; not a text model vision capability
Use /v1/images/generations or /v1/images/edits. Images are billed per image; confirm pricing on the image pricing page or in the completed request.

6️⃣ Error Handling

Common Error Codes

Code Description Solution
400 Invalid request Check parameters format
401 Authentication failed Check API Key
403 Permission denied Check balance or access
404 Model not found Check model name
429 Rate limit exceeded Slow down, retry later
500 Server error Retry or contact support

7️⃣ Usage Limits

Context Window Limits

Model Context Window Max Output
Claude Opus 5.0 Upstream model limit Upstream model limit
Claude Sonnet 5 Upstream model limit Upstream model limit
GPT-5.6 Terra Upstream model limit Upstream model limit
GPT-5.6 Sol Upstream model limit Upstream model limit
GLM-5.3 Upstream model limit Upstream model limit