DEV Community

Infistar 无限星河AI
Infistar 无限星河AI

Posted on

One API key for Claude Code, images and video: a measured walkthrough

This post shows three things you can do with a single Infistar API key, each measured on 2026-12-01:

  1. Run Claude Code on Claude, GPT or Gemini models by changing one environment variable.
  2. Generate an image with one HTTP request.
  3. Generate a short video: submit, poll, download.

Setup

Create a key under Tokens in the Infistar console and export it:

export INFISTAR_API_KEY="your_key"
Enter fullscreen mode Exit fullscreen mode

Image and video generation spend balance. Give the key a spending cap before you experiment.

1. Claude Code on three model families

export ANTHROPIC_BASE_URL="https://infistar.ai"
export ANTHROPIC_AUTH_TOKEN="$INFISTAR_API_KEY"
export ANTHROPIC_MODEL="claude-sonnet-5-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-sonnet-5-5"
claude
Enter fullscreen mode Exit fullscreen mode
  • Do not append /v1 to the base URL; Claude Code adds the path itself.
  • ANTHROPIC_DEFAULT_HAIKU_MODEL is the model Claude Code uses for small background work. Setting it to the same model keeps every request on the model you chose.

To switch, change the two model names and keep the key and URL: gpt-6-luna, gemini-3.8-flash. Exact model IDs are on the model list.

What we ran. A folder with a buggy inventory.py (remove() lets stock go negative) and a README.md describing the correct behaviour. The prompt asked Claude Code to fix remove() per the README, write at least 8 unittest cases, run them, and summarise the change in one sentence. We ran it non-interactively (claude -p), Claude Code 2.1.332, then re-ran its tests and a separate hidden check that stock shortages and unknown items raise ValueError.

All three fixed the bug: their own tests passed, and so did the hidden check.

Model First output Total time Model requests Charged (CNY)
claude-sonnet-5-5 5.7 s 106.7 s 14 ¥0.329
gpt-6-luna 6.1 s 34.1 s 5 ¥0.022
gemini-3.8-flash 6.1 s 29.6 s 7 ¥0.263
  • "First output" counts from launching Claude Code, including its own start-up.
  • "Charged" is the sum of every request in that run, taken from the usage log.
  • One run per model at the same hour gives a sense of scale, not a ranking. Current prices are on each model page: claude-sonnet-5-5, gpt-6-luna, gemini-3.8-flash.

2. Generate an image

import os
import requests

BASE = "https://infistar.ai"
HEADERS = {"Authorization": "Bearer " + os.environ["INFISTAR_API_KEY"]}

r = requests.post(
    BASE + "/v1/images/generations",
    headers=HEADERS,
    json={
        "model": "qwen-image-3.0",
        "prompt": "An orange cat with round glasses reading at a desk, rain outside the window, warm desk lamp, illustration",
        "size": "1024x1024",
        "n": 1,
    },
    timeout=600,
)
body = r.json()
if not body.get("data"):
    raise SystemExit(f"No image: HTTP {r.status_code} {body}")
url = body["data"][0]["url"]
with open("cat.png", "wb") as f:
    f.write(requests.get(url, timeout=120).content)
print("saved cat.png")
Enter fullscreen mode Exit fullscreen mode

Two things we learned while measuring:

  • Check for data, not just the status code. A request that waits too long can come back as HTTP 200 with no data; the usage log then records a timeout and no charge.
  • Use a long client timeout. Images take from tens of seconds to a few minutes. If your client disconnects first, you lose the result.

Some models return b64_json instead of url; check which field you got.

3. Generate a video

import os
import time
import requests

BASE = "https://infistar.ai"
HEADERS = {"Authorization": "Bearer " + os.environ["INFISTAR_API_KEY"]}

# 1. Submit
r = requests.post(
    BASE + "/v1/videos",
    headers=HEADERS,
    json={
        "model": "doubao-seedance-2.0-mini",
        "prompt": "A wooden boat drifting across a lake at dawn, mist lifting, slow push-in",
        "seconds": "5",
        "size": "1280x720",
    },
    timeout=180,
)
r.raise_for_status()
task_id = r.json()["id"]
print("task", task_id)

# 2. Poll every 5 seconds. Poll again, never resubmit
while True:
    time.sleep(5)
    task = requests.get(BASE + "/v1/videos/" + task_id, headers=HEADERS, timeout=60).json()
    print(task["status"])
    if task["status"] == "completed":
        break
    if task["status"] == "failed":
        raise SystemExit(f"failed: {task.get('error')}")

# 3. Download
video = requests.get(BASE + "/v1/videos/" + task_id + "/content", headers=HEADERS, timeout=300)
video.raise_for_status()
with open("boat.mp4", "wb") as f:
    f.write(video.content)
print("saved boat.mp4")
Enter fullscreen mode Exit fullscreen mode

While queued, different models report different states (we saw queued and pending), then in_progress, then completed. Only treat completed and failed as final.

Measured. Both scripts above ran exactly as printed:

  • Image: 1024x1024 PNG in 58.0 s, charged ¥0.175.
  • Video: 1280x720, 5.04 s, H.264 at 24 fps, 140.5 s from submit to download. The video model reserves an amount when the task is submitted (¥2.755) and refunds the difference once the result is known (¥1.336), so the net charge was ¥1.419.

Current prices: qwen-image-3.0, doubao-seedance-2.0-mini.

Links

Top comments (0)