1. Create an API key
Open “API Keys” in the EcoToken console. The page always masks the value, while an authenticated owner can use the copy icon to retrieve the full API Key. Store it in a password manager or secure environment variable. Wait for the key to become Active before calling a model.
2. Choose a model
Open the EcoToken workspace, select “Model pricing” in the left navigation, then use the copy icon in the “Model ID” column to copy the exact model ID.

3. Call the API
Switch between the cURL, Python, and Node.js examples. For OpenAI SDKs, set the base URL to https://ecotoken.ecophase-ai.com/v1 and do not append another /v1.
curl "https://ecotoken.ecophase-ai.com/v1/chat/completions" \
-H "Authorization: Bearer $ECOTOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"YOUR_MODEL_ID","messages":[{"role":"user","content":"Hello"}],"stream":false}'4. Send an image (Vision)
deepseek-v4.1-flash accepts images in model requests. Use an HTTPS URL that the upstream service can access, or encode a local image as Base64 and send it inline.
This Chat Completions example sends an image URL:
curl "https://ecotoken.ecophase-ai.com/v1/chat/completions" \
-H "Authorization: Bearer $ECOTOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model":"deepseek-v4.1-flash",
"messages":[{
"role":"user",
"content":[
{"type":"text","text":"Describe this image"},
{"type":"image_url","image_url":{"url":"https://example.com/image.png"}}
]
}],
"stream":false
}'For a local image, replace image_url.url with data:image/png;base64,BASE64_DATA. Each compatible endpoint uses its own image shape:
| Endpoint | Image shape |
|---|---|
/v1/chat/completions | {"type":"image_url","image_url":{"url":"https://..."}}; the URL may also be a Base64 data URI |
/v1/responses | {"type":"input_image","image_url":"https://..."}; image_url is a string and may also be a Base64 data URI |
/v1/messages | Anthropic image block; source.type must be base64, with PNG, JPEG, GIF, or WebP data |
Only models declared Vision-capable accept image content. Use the exact model ID deepseek-v4.1-flash; sending an image to another model returns 403 permission_error. Images are converted into input tokens and billed at the model's existing input-token rate.
Common errors
401: invalid, pending, or revoked key.402: insufficient available balance.403: missing service or model permission.429: rate or concurrency limit; honorRetry-After.503: no upstream or reservation service available.504: upstream timeout.
The gateway does not automatically retry generation POST requests. Generated tokens are still settled when a streaming request is interrupted.
