If your code already calls an OpenAI-style endpoint, you are changing the base URL and the model name.
https://poolmill.com/v1GET /v1/modelsEvery sample uses a live model ID from the router, so the docs cannot drift from the API.
# 1. put your key in the environment export POOLMILL_API_KEY="pool_..." # 2. call the OpenAI-compatible endpoint curl https://poolmill.com/v1/chat/completions \ -H "Authorization: Bearer $POOLMILL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek/deepseek-v4-flash-vision-exp", "messages": [{"role": "user", "content": "Say hello."}] }'
from openai import OpenAI client = OpenAI( base_url="https://poolmill.com/v1", api_key="pool_...", # from the console ) r = client.chat.completions.create( model="deepseek/deepseek-v4-flash-vision-exp", messages=[{"role": "user", "content": "Say hello."}], ) print(r.choices[0].message.content)
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://poolmill.com/v1", apiKey: process.env.POOLMILL_API_KEY, // pool_... }); const r = await client.chat.completions.create({ model: "deepseek/deepseek-v4-flash-vision-exp", messages: [{ role: "user", content: "Say hello." }], }); console.log(r.choices[0].message.content);
Standard OpenAI request and response shapes, including temperature, top_p, max_tokens, stop, tools and response_format.
curl https://poolmill.com/v1/chat/completions \ -H "Authorization: Bearer $POOLMILL_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek/deepseek-v4-flash-vision-exp", "messages": [ {"role": "system", "content": "You are terse."}, {"role": "user", "content": "What is a vector index?"} ], "max_tokens": 200, "temperature": 0.2 }'
Pass "stream": true to receive server-sent events. Any OpenAI-compatible client library handles this transparently.
from openai import OpenAI client = OpenAI(base_url="https://poolmill.com/v1", api_key="pool_...") stream = client.chat.completions.create( model="deepseek/deepseek-v4-flash-vision-exp", messages=[{"role": "user", "content": "Write a haiku about caching."}], stream=True, ) for chunk in stream: delta = chunk.choices[0].delta.content if delta: print(delta, end="", flush=True)
When a prompt repeats content the provider has seen, those tokens bill at the cached rate — on DeepSeek v4.1 Flash that is 50x cheaper. Read prompt_tokens_details.cached_tokens to see the split.
{
"usage": {
"prompt_tokens": 1233,
"completion_tokens": 5,
"total_tokens": 1238,
"prompt_tokens_details": { "cached_tokens": 1024 }
}
}Anthropic-shaped requests are accepted at the same endpoint. Use the Anthropic SDK with a custom base URL.
from anthropic import Anthropic client = Anthropic(base_url="https://poolmill.com/v1", api_key="pool_...") msg = client.messages.create( model="deepseek/deepseek-v4-flash-vision-exp", max_tokens=256, stream=True, messages=[{"role": "user", "content": "Summarise this release note."}], ) for event in msg: print(event)
Errors are JSON with an error object, matching the OpenAI shape: 401 bad key, 403 model not in your package, 429 credit exhausted, 5xx safe to retry with backoff.
{
"error": {
"message": "Budget has been exceeded! Current cost: 9.5, Max budget: 9.0",
"type": "budget_exceeded",
"code": "429"
}
}Capacity is pooled upstream. Steady production traffic is unaffected; extreme bursts at peak may surface as 429 or 5xx — retry with exponential backoff.
import random, time from openai import OpenAI, APIStatusError client = OpenAI(base_url="https://poolmill.com/v1", api_key="pool_...") def complete(**kw): for attempt in range(5): try: return client.chat.completions.create(**kw) except APIStatusError as e: # 429 = no credit or rate limit; 5xx = upstream capacity if e.status_code < 500 and e.status_code != 429: raise time.sleep(min(2 ** attempt + random.random(), 20)) raise RuntimeError("giving up after 5 attempts")
USD per 1M tokens: input / cached input / output, charged against prepaid credit.
export POOLMILL_API_KEY="pool_..." curl https://poolmill.com/v1/models \ -H "Authorization: Bearer $POOLMILL_API_KEY"