{{docs.790d883ad1}}
- {{docs.70589413a3}}
{{docs.f48aafb884}}- {{docs.connectionAuth}}
{{docs.a33af39752}}<{{docs.358b5f6606}}>- {{docs.connectionEndpoints}}
/chat/completions/responses/models/images/generations/images/edits
{{docs.fc0fb94ff7}}
{{docs.1d7af122d6}}
{{docs.getStarted}}
{{docs.commonLead}}
{{docs.e13c8f76c2}}<YOUR_API_KEY>{{docs.1509149247}}
{{docs.f48aafb884}}{{docs.a33af39752}}<{{docs.358b5f6606}}>/chat/completions/responses/models/images/generations/images/editsclaude-{{docs.closeSentence}}{{docs.16090be1a2}}{{docs.3bd8cf1c63}}{{docs.55442fea7e}}<{{docs.358b5f6606}}>/v1/messageshttps://api.edgeweigh.comx-goog-api-key: <YOUR_API_KEY>/v1beta/models/{model}:generateContenthttps://api.edgeweigh.com/v1Authorization: Bearer <YOUR_API_KEY>/contents/generations/tasks/contents/generations/tasks/{id}{{docs.connectionSDKs}}
GET /v1/models).from openai import OpenAI
client = OpenAI(base_url="https://api.edgeweigh.com/v1", api_key="<YOUR_API_KEY>")
for m in client.models.list():
print(m.id)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.edgeweigh.com/v1",
apiKey: "<YOUR_API_KEY>",
});
for await (const m of client.models.list()) console.log(m.id);curl https://api.edgeweigh.com/v1/models \ -H "Authorization: Bearer <YOUR_API_KEY>"
| {{docs.9061383b8e}} | {{docs.f47f1edc44}} |
|---|---|
| {{docs.b8cf5fd452}} | {{docs.5b0c0cbca3}}Retry-After{{docs.545d5da517}}x-ratelimit-*{{docs.e3ee915a8e}}anthropic-ratelimit-*{{docs.5884836e1c}} |
{{docs.e4427974c9}}insufficient_quota / insufficient_user_quota | {{docs.cf70e96e5a}} |
| {{docs.866c0b5524}} | {{docs.1a81da9aaa}} |
| {{docs.d430997a5e}} | {{docs.599f92a628}} |
| {{docs.59b46d3c46}} | {{docs.8871434fe7}} |
| {{docs.7815571bd7}} | {{docs.http400}} |
| {{docs.54e624dd30}} | {{docs.f649282799}} |
x-request-id{{docs.71393f04cd}}high, xhigh{{docs.e3ee915a8e}}max{{docs.a0e943988d}}{{docs.textBilling}}
{{docs.imageBilling}}
{{docs.noImageCharge}}
{{docs.text}}
{{docs.claudeLead}}
{{docs.exampleModel}}
from openai import OpenAI
client = OpenAI(base_url="https://api.edgeweigh.com/v1", api_key="<YOUR_API_KEY>")
r = client.chat.completions.create(
model="claude-opus-4-6",
messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.edgeweigh.com/v1",
apiKey: "<YOUR_API_KEY>",
});
const r = await client.chat.completions.create({
model: "claude-opus-4-6",
messages: [{ role: "user", content: "Hello" }],
});
console.log(r.choices[0].message.content);curl https://api.edgeweigh.com/v1/chat/completions \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-6",
"messages": [{"role": "user", "content": "Hello"}]
}'from anthropic import Anthropic
client = Anthropic(base_url="https://api.edgeweigh.com", api_key="<YOUR_API_KEY>")
r = client.messages.create(
model="claude-opus-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(next(b.text for b in r.content if b.type == "text"))import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.edgeweigh.com",
apiKey: "<YOUR_API_KEY>",
});
const r = await client.messages.create({
model: "claude-opus-4-6",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello" }],
});
console.log(r.content.find((b) => b.type === "text")?.text);curl https://api.edgeweigh.com/v1/messages \
-H "x-api-key: <YOUR_API_KEY>" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-6",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello"}]
}'{{docs.shapeModelNote}}
| {{docs.shape}} | {{docs.790d883ad1}} | {{docs.3d0b6b862c}} |
|---|---|---|
| {{docs.choose}} | {{docs.openaiChoose}} | {{docs.anthropicChoose}} |
| {{docs.fce7fec2a5}} | /v1/chat/completions | /v1/messages |
| {{docs.66880d2d82}} | Authorization: Bearer | x-api-key |
| {{docs.fields}} | model, messages | model, messages, max_tokens |
| {{docs.delivery}} | choices[0].message.content | content[] |
{{docs.claudeParams}}
{{docs.openaiOutput}}
{{docs.anthropicOutput}}
{{docs.3f3c421836}}cache_control{{docs.0ffb9dfbdb}}/v1/messages{{docs.c8fbe900f4}}/v1/chat/completions, cache_control{{docs.48a9dd0346}}
{{docs.text}}
{{docs.gptLead}}
{{docs.exampleModel}}
from openai import OpenAI
client = OpenAI(base_url="https://api.edgeweigh.com/v1", api_key="<YOUR_API_KEY>")
r = client.chat.completions.create(
model="gpt-5.4",
messages=[{"role": "user", "content": "Hello"}],
)
print(r.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.edgeweigh.com/v1",
apiKey: "<YOUR_API_KEY>",
});
const r = await client.chat.completions.create({
model: "gpt-5.4",
messages: [{ role: "user", content: "Hello" }],
});
console.log(r.choices[0].message.content);curl https://api.edgeweigh.com/v1/chat/completions \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4",
"messages": [{"role": "user", "content": "Hello"}]
}'{{docs.gptParams}}
{{docs.openaiOutput}}
{{docs.5f232ef573}}
/v1/chat/completions| {{docs.62845f31a2}} | {{docs.a5dc35f1ff}} |
|---|---|
stop{{docs.39c3c6d9e6}} | Unsupported parameter: 'stop' is not supported with this model. |
{{docs.bb33dbdb2f}}max_completion_tokens{{docs.99a3d05bfc}}max_tokens. | Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead. |
{{docs.95589b5c4c}}max_completion_tokens{{docs.fea94b0f93}} | max_tokens is too large: N. This model supports at most 128000 completion tokens, whereas you provided N. |
{{docs.dee4b7db2b}}service_tier{{docs.fae0b8449e}}default{{docs.e1a3e78cb5}}auto{{docs.ddf285ad2d}} | Only service_tier 'default' is supported. |
/v1/responses| {{docs.62845f31a2}} | {{docs.a5dc35f1ff}} |
|---|---|
stop{{docs.7dadd2a187}} | Unknown parameter: 'stop'. Did you mean 'store'? |
{{docs.beeb1b571f}}previous_response_id{{docs.e3ee915a8e}}conversation{{docs.37cbbd86bc}}input{{docs.6a0a2ac805}}id{{docs.bae7862a78}}previous_response_id). | Stateful responses are not supported on this platform: omit 'previous_response_id' and send the full conversation in 'input'. |
{{docs.dee4b7db2b}}service_tier{{docs.fae0b8449e}}default{{docs.e1a3e78cb5}}auto{{docs.ddf285ad2d}} | Only service_tier 'default' is supported. |
/v1/messages{{docs.3c7f5957d4}}Model '<id>' is not available on the Messages API. Use /v1/chat/completions or /v1/responses.{{docs.23da30775f}}/v1/chat/completions{{docs.e1a3e78cb5}}/v1/responses{{docs.98876abd11}}
{{docs.image}}
{{docs.openaiImageLead}}
{{docs.exampleModel}}
import base64
from openai import OpenAI
client = OpenAI(base_url="https://api.edgeweigh.com/v1", api_key="<YOUR_API_KEY>")
r = client.images.generate(
model="gpt-image-2",
prompt="A small ceramic teapot on a wooden table by a window",
size="1536x1024",
quality="medium",
)
open("out.png", "wb").write(base64.b64decode(r.data[0].b64_json))
print(r.usage.output_tokens) # image tokens billed for this pictureimport fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.edgeweigh.com/v1",
apiKey: "<YOUR_API_KEY>",
});
const r = await client.images.generate({
model: "gpt-image-2",
prompt: "A small ceramic teapot on a wooden table by a window",
size: "1536x1024",
quality: "medium",
});
fs.writeFileSync("out.png", Buffer.from(r.data[0].b64_json, "base64"));
console.log(r.usage.output_tokens); // image tokens billed for this picturecurl https://api.edgeweigh.com/v1/images/generations \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A small ceramic teapot on a wooden table by a window",
"size": "1536x1024",
"quality": "medium"
}'
# response: {"data":[{"b64_json":"..."}],"usage":{"input_tokens":…,"output_tokens":…}}import base64
from openai import OpenAI
client = OpenAI(base_url="https://api.edgeweigh.com/v1", api_key="<YOUR_API_KEY>")
r = client.images.edit(
model="gpt-image-2",
image=open("ref.png", "rb"),
prompt="Make it night time; keep the composition identical",
size="1024x1024",
quality="low",
)
open("edited.png", "wb").write(base64.b64decode(r.data[0].b64_json))import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.edgeweigh.com/v1",
apiKey: "<YOUR_API_KEY>",
});
const r = await client.images.edit({
model: "gpt-image-2",
image: fs.createReadStream("ref.png"),
prompt: "Make it night time; keep the composition identical",
size: "1024x1024",
quality: "low",
});
fs.writeFileSync("edited.png", Buffer.from(r.data[0].b64_json, "base64"));curl https://api.edgeweigh.com/v1/images/edits \ -H "Authorization: Bearer <YOUR_API_KEY>" \ -F model=gpt-image-2 \ -F "image[]=@ref.png" \ -F "prompt=Make it night time; keep the composition identical" \ -F size=1024x1024 \ -F quality=low
{{docs.openaiShared}}
POST /v1/images/generations{{docs.a1b50090f8}}POST /v1/images/edits{{docs.c4d6ff7123}}image[]{{docs.d86d819f49}}mask)WxH{{docs.d35a071f3e}}auto/edits{{docs.b915b80609.noPrice}}stream / partial_images, response_format: url{{docs.fdd6ec6f29}}data[].b64_json{{docs.a0e52d12f2}}output_format{{docs.c0d9ef85dc}}background: transparent{{docs.29d2ed36e7}}{{docs.8b6c31e885}}{{docs.d43d4bceb8}}{{docs.802d2a1e20}}
{{docs.image}}
{{docs.geminiImageLead}}
{{docs.exampleModel}}
from google import genai
from google.genai import types
client = genai.Client(
api_key="<YOUR_API_KEY>",
http_options={"base_url": "https://api.edgeweigh.com"},
)
r = client.models.generate_content(
model="gemini-3-pro-image",
contents="A small ceramic teapot on a wooden table by a window",
config=types.GenerateContentConfig(
response_modalities=["IMAGE"],
image_config=types.ImageConfig(aspect_ratio="16:9", image_size="2K"),
),
)
part = r.candidates[0].content.parts[0]
open("out.png", "wb").write(part.inline_data.data)import fs from "node:fs";
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({
apiKey: "<YOUR_API_KEY>",
httpOptions: { baseUrl: "https://api.edgeweigh.com" },
});
const r = await ai.models.generateContent({
model: "gemini-3-pro-image",
contents: "A small ceramic teapot on a wooden table by a window",
config: {
responseModalities: ["IMAGE"],
imageConfig: { aspectRatio: "16:9", imageSize: "2K" },
},
});
const data = r.candidates[0].content.parts[0].inlineData.data;
fs.writeFileSync("out.png", Buffer.from(data, "base64"));curl https://api.edgeweigh.com/v1beta/models/gemini-3-pro-image:generateContent \
-H "x-goog-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"role": "user", "parts": [
{"text": "A small ceramic teapot on a wooden table by a window"}
]}],
"generationConfig": {
"responseModalities": ["IMAGE"],
"imageConfig": {"aspectRatio": "16:9", "imageSize": "2K"}
}
}'
# response: candidates[0].content.parts[0].inlineData.data (base64 PNG)from google import genai
from google.genai import types
client = genai.Client(
api_key="<YOUR_API_KEY>",
http_options={"base_url": "https://api.edgeweigh.com"},
)
r = client.models.generate_content(
model="gemini-3.1-flash-image",
contents=[
types.Part.from_bytes(data=open("ref.png", "rb").read(), mime_type="image/png"),
"Make it night time; keep the composition identical",
],
config=types.GenerateContentConfig(response_modalities=["IMAGE"]),
)
part = r.candidates[0].content.parts[-1]
open("edited.png", "wb").write(part.inline_data.data)import fs from "node:fs";
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({
apiKey: "<YOUR_API_KEY>",
httpOptions: { baseUrl: "https://api.edgeweigh.com" },
});
const ref = fs.readFileSync("ref.png").toString("base64");
const r = await ai.models.generateContent({
model: "gemini-3.1-flash-image",
contents: [
{ inlineData: { mimeType: "image/png", data: ref } },
{ text: "Make it night time; keep the composition identical" },
],
config: { responseModalities: ["IMAGE"] },
});
const parts = r.candidates[0].content.parts;
const last = parts[parts.length - 1].inlineData.data;
fs.writeFileSync("edited.png", Buffer.from(last, "base64"));# base64-encode the reference first: REF=$(base64 -w0 ref.png)
curl https://api.edgeweigh.com/v1beta/models/gemini-3.1-flash-image:generateContent \
-H "x-goog-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"role": "user", "parts": [
{"inlineData": {"mimeType": "image/png", "data": "'"$REF"'"}},
{"text": "Make it night time; keep the composition identical"}
]}],
"generationConfig": {"responseModalities": ["IMAGE"]}
}'{{docs.4785544f1b}}parts{{docs.374d9fbf0b}}generateContent{{docs.8a939d7ee7}}imageSize{{docs.2036479b8b}}
POST /v1beta/models/{model}:generateContent{{docs.92f1a79f3c}}generationConfig.responseModalities: ["IMAGE"]imageConfig.imageSize{{docs.7624012666}}aspectRatio 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9inlineData{{docs.f9b47a4715}}contents[].parts[]{{docs.geminiRefLimit}}candidates[0].content.parts[].inlineData{{docs.geminiOutput}}"thought": true{{docs.geminiDraftTail}}{{docs.8b6c31e885}}{{docs.d43d4bceb8}}{{docs.802d2a1e20}}
{{docs.video}}
{{docs.seedanceLead}}
{{docs.exampleModel}}
{{docs.seedancePoll}}
# pip install requests
import os
import time
import requests
base = "https://api.edgeweigh.com/v1"
headers = {"Authorization": "Bearer " + os.environ["API_KEY"]}
body = {
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "a red kite over the sea"
}
],
"resolution": "720p",
"duration": 5
}
created = requests.post(base + "/contents/generations/tasks", headers=headers,
json=body, timeout=60)
created.raise_for_status()
task_id = created.json()["id"]
time.sleep(10)
result = requests.get(base + "/contents/generations/tasks/" + task_id,
headers=headers, timeout=60)
result.raise_for_status()
print(result.json())
page = requests.get(base + "/contents/generations/tasks?page_num=1&page_size=10",
headers=headers, timeout=60)
page.raise_for_status()
print(page.json())const base = "https://api.edgeweigh.com/v1";
const headers = { Authorization: `Bearer ${process.env.API_KEY}` };
const body = {
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "a red kite over the sea"
}
],
"resolution": "720p",
"duration": 5
};
const created = await fetch(base + "/contents/generations/tasks", {
method: "POST", headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify(body),
});
if (!created.ok) throw new Error(await created.text());
const { id } = await created.json();
await new Promise(resolve => setTimeout(resolve, 10000));
const result = await fetch(base + "/contents/generations/tasks/" + id, { headers });
if (!result.ok) throw new Error(await result.text());
const video = await result.json();
console.log(video);
const page = await fetch(
base + "/contents/generations/tasks?page_num=1&page_size=10", { headers },
);
if (!page.ok) throw new Error(await page.text());
console.log(await page.json());curl -sS --fail-with-body https://api.edgeweigh.com/v1/contents/generations/tasks \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '
{
"model": "doubao-seedance-2-0-260128",
"content": [
{
"type": "text",
"text": "a red kite over the sea"
}
],
"resolution": "720p",
"duration": 5
}
'
# Set TASK_ID to the id returned above.
TASK_ID="task_REPLACE_ME"
sleep 10
curl -sS --fail-with-body \
"https://api.edgeweigh.com/v1/contents/generations/tasks/$TASK_ID" \
-H "Authorization: Bearer $API_KEY"
curl -sS --fail-with-body \
"https://api.edgeweigh.com/v1/contents/generations/tasks?page_num=1&page_size=10" \
-H "Authorization: Bearer $API_KEY"# pip install requests
import os
import time
import requests
base = "https://api.edgeweigh.com/v1"
headers = {"Authorization": "Bearer " + os.environ["API_KEY"]}
body = {
"model": "doubao-seedance-2-0-260128",
"prompt": "a red kite over the sea",
"seconds": "5",
"size": "1280x720"
}
created = requests.post(base + "/videos", headers=headers,
json=body, timeout=60)
created.raise_for_status()
task_id = created.json()["id"]
time.sleep(10)
result = requests.get(base + "/videos/" + task_id,
headers=headers, timeout=60)
result.raise_for_status()
print(result.json())
page = requests.get(base + "/videos?limit=20&order=desc",
headers=headers, timeout=60)
page.raise_for_status()
print(page.json())
if result.json()["status"] == "completed":
redirect = requests.get(base + "/videos/" + task_id + "/content",
headers=headers, allow_redirects=False, timeout=60)
if redirect.status_code != 302:
raise RuntimeError(redirect.text)
download = requests.get(redirect.headers["Location"], timeout=60)
download.raise_for_status()
with open("video.mp4", "wb") as output:
output.write(download.content)const base = "https://api.edgeweigh.com/v1";
const headers = { Authorization: `Bearer ${process.env.API_KEY}` };
const body = {
"model": "doubao-seedance-2-0-260128",
"prompt": "a red kite over the sea",
"seconds": "5",
"size": "1280x720"
};
const created = await fetch(base + "/videos", {
method: "POST", headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify(body),
});
if (!created.ok) throw new Error(await created.text());
const { id } = await created.json();
await new Promise(resolve => setTimeout(resolve, 10000));
const result = await fetch(base + "/videos/" + id, { headers });
if (!result.ok) throw new Error(await result.text());
const video = await result.json();
console.log(video);
const page = await fetch(base + "/videos?limit=20&order=desc", { headers });
if (!page.ok) throw new Error(await page.text());
console.log(await page.json());
if (video.status === "completed") {
const redirect = await fetch(base + "/videos/" + id + "/content", {
headers, redirect: "manual",
});
if (redirect.status !== 302) throw new Error(await redirect.text());
const download = await fetch(redirect.headers.get("location"));
if (!download.ok) throw new Error(await download.text());
const { writeFile } = await import("node:fs/promises");
await writeFile("video.mp4", Buffer.from(await download.arrayBuffer()));
}curl -sS --fail-with-body https://api.edgeweigh.com/v1/videos \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '
{
"model": "doubao-seedance-2-0-260128",
"prompt": "a red kite over the sea",
"seconds": "5",
"size": "1280x720"
}
'
# Set TASK_ID to the id returned above.
TASK_ID="task_REPLACE_ME"
sleep 10
curl -sS --fail-with-body \
"https://api.edgeweigh.com/v1/videos/$TASK_ID" \
-H "Authorization: Bearer $API_KEY"
curl -sS --fail-with-body \
"https://api.edgeweigh.com/v1/videos?limit=20&order=desc" \
-H "Authorization: Bearer $API_KEY"
# Only after status is completed. Do not use --location-trusted.
curl -sS --fail-with-body -L \
"https://api.edgeweigh.com/v1/videos/$TASK_ID/content" \
-H "Authorization: Bearer $API_KEY" -o video.mp4{{docs.seedanceFormats}}
POST /v1/contents/generations/tasksGET /v1/contents/generations/tasks/{id}GET /v1/contents/generations/tasks{{docs.seedanceArkList}}
POST /v1/videosGET /v1/videos/{id}GET /v1/videosGET /v1/videos/{id}/content{{docs.seedanceOpenaiList}}
{{docs.seedancePending}}
{{docs.seedanceArkFields}}
{{docs.seedanceOpenaiFields}}
resolutionduration / secondscontentrole{{docs.seedanceArkOutput}}
{{docs.seedanceOpenaiOutput}}
{{docs.seedanceDelivery}}
{{docs.seedanceBilling}}
{{docs.seedanceTokens}}
| {{docs.9061383b8e}} | {{docs.f47f1edc44}} |
|---|---|
| {{docs.seedance400}} | {{docs.seedance400Fix}} |
| {{docs.seedanceFace}} | {{docs.seedanceFaceFix}} |
| {{docs.seedance409}} | {{docs.seedance409Fix}} |
| {{docs.seedance410}} | {{docs.seedance410Fix}} |
| {{docs.seedanceStorage}} | {{docs.seedanceStorageFix}} |
{{overview.101d7c2268}}
{{overview.629e263f8c}}
{{overview.bea80bab3d}}
{{overview.451a516e64}}
{{overview.ec8767f0fc}}
{{overview.bae7cffe31}}
{{models.dc9b47c81b}}
{{audit.6fbf8aa012}}
list_usd × price_ratio = charged_usd{{audit.d26cdd3d20}}{{audit.5d9b4fe434}}
charged_usd{{audit.3ee15f90ed}}cost_usd{{audit.ee7fa88daa}}price_ratio{{audit.b0290ae8d0}}list_usd{{audit.602e9ba81d}}{{audit.f48bd051aa}}
{{audit.9fbb6f6864}}
{{audit.videoCostNote}}
{{audit.578bfa31a5}}
{{keys.c4c626646e}}
{{account.0168fbcaa9}}
{{keys.6a1b6266d9}}
{{keys.3c53d0fa07}}
{{keys.f2f10a08b4}}
{{keys.d1f23fe857}}
{{keys.9695619d99}}
{{keys.1801907159}}
{{keys.35b0e593b1}}