Migrate from OpenAI
Switch from OpenAI to Blackfuel by changing two values — the base URL and your API key
Blackfuel serves OpenAI-compatible endpoints your client already calls: the OpenAI Chat
Completions API at POST /v1/chat/completions, plus POST /v1/embeddings and
GET /v1/models. Requests and responses keep the shapes your code builds and reads, so a
migration comes down to two values and a model ID.
What Changes
| OpenAI | Blackfuel | |
|---|---|---|
| Base URL | https://api.openai.com/v1 | https://api.blackfuel.ai/v1 |
| API key | OPENAI_API_KEY | BLACKFUEL_API_KEY |
| Model IDs | gpt-4o, gpt-3.5-turbo, etc. | See Available Models |
Update Your Code
# Before
import os
import openai
client = openai.OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
# After
import os
import openai
client = openai.OpenAI(
base_url="https://api.blackfuel.ai/v1",
api_key=os.environ["BLACKFUEL_API_KEY"],
)// Before
import OpenAI from 'openai';
const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
// After
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.blackfuel.ai/v1',
apiKey: process.env.BLACKFUEL_API_KEY
});# Before
curl https://api.openai.com/v1/chat/completions \
-H "Authorization: Bearer $OPENAI_API_KEY" ...
# After
curl https://api.blackfuel.ai/v1/chat/completions \
-H "Authorization: Bearer $BLACKFUEL_API_KEY" ...Update Model Names
Blackfuel serves its own vendor/model IDs. An OpenAI model name is not one of them, so a
request that still carries gpt-4o returns 404 with code: model_not_found (see
Invalid Request Errors).
Pick the replacement from GET /v1/models by matching three fields on each entry:
task—text-generationfor chat,embeddingfor embeddings.context_length— must cover your longest prompt plus its completion.supported_parameters— must list the parameters your requests send, such astools,response_format, orreasoning_effort.
Available Models lists the catalog with pricing, and the Model Object documents every field.
Using Environment Variables
The OpenAI SDKs read OPENAI_BASE_URL and OPENAI_API_KEY from the environment, so you can
point an unmodified codebase at Blackfuel by exporting the Blackfuel values under the names the SDK
already looks for:
export OPENAI_BASE_URL="https://api.blackfuel.ai/v1"
export OPENAI_API_KEY="$BLACKFUEL_API_KEY"The client then needs no arguments:
import openai
client = openai.OpenAI() # reads OPENAI_BASE_URL and OPENAI_API_KEYimport OpenAI from 'openai';
const client = new OpenAI(); // reads OPENAI_BASE_URL and OPENAI_API_KEYSupported Features
The request parameters your OpenAI code already sends carry over:
- Streaming —
stream: true, with the same SSE chunk format. See Streaming. - Tool calling —
toolsandtool_choice. See Tool Calling. - Structured output —
response_format, bothjson_schemaandjson_object. See Reasoning with Structured Output. - Logprobs —
logprobsandtop_logprobsreturn per-token candidates underchoices[].logprobs. - Multimodal input —
image_urlcontent parts work on models whoseinput_modalitiesincludesimage; any other model rejects the request with400. See Vision (Multimodal). - Embeddings —
POST /v1/embeddings. See Embeddings. - Reasoning —
reasoning_effort, with the model's reasoning content inmessage.reasoning. See Reasoning.
Each GET /v1/models entry lists that model's
supported_parameters.
EU Data Residency
Where the catalog lists an :eu variant of a model, that variant is served from the EU. Pass
the variant ID as the model:
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4-Flash-0731:eu",
messages=[{"role": "user", "content": "Hello"}],
)const response = await client.chat.completions.create({
model: "deepseek-ai/DeepSeek-V4-Flash-0731:eu",
messages: [{ role: "user", content: "Hello" }],
});See EU-Hosted Models for which
models have an :eu variant.