1. Create an API key
Open API keys, sign in, and create a key. Copy it when it is shown; the full value cannot be retrieved later. Check your available credit in the dashboard before sending inference requests.
export FE_API_KEY="YOUR_API_KEY"
export OPENAI_BASE_URL="https://formalengines.com/inference/v1"Keep the key on your server or in a local environment variable. Do not include it in browser-side JavaScript, a public repository, or a shared screenshot.
2. Send a request
The request below uses deepseek-v4-1-flash. The quoted heredoc keeps apostrophes and other text in your JSON intact. Only the Authorization header expands your environment variable.
curl --fail-with-body https://formalengines.com/inference/v1/chat/completions \
-H "Authorization: Bearer $FE_API_KEY" \
-H 'Content-Type: application/json' \
--data-binary @- <<'JSON'
{
"model": "deepseek-v4-1-flash",
"messages": [{"role": "user", "content": "Hey how's it going?"}],
"max_tokens": 256
}
JSONRead the answer from choices[0].message.content. A model may use some of its output budget for reasoning; increase the budget if you receive a truncated or reasoning-only answer.
{
"id": "chatcmpl_example",
"object": "chat.completion",
"model": "deepseek-v4-1-flash",
"choices": [{
"index": 0,
"message": {"role": "assistant", "content": "Hello! How can I help?"},
"finish_reason": "stop"
}],
"usage": {"prompt_tokens": 18, "completion_tokens": 9, "total_tokens": 27}
}3. Use an OpenAI SDK
Install openai with pip install openai for Python or npm install openai for Node.js. Configure the SDK base URL with /inference/v1; the SDK appends /chat/completions.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["FE_API_KEY"],
base_url="https://formalengines.com/inference/v1",
)
response = client.chat.completions.create(
model="deepseek-v4-1-flash",
messages=[{"role": "user", "content": "Explain caching in one sentence."}],
max_tokens=256,
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.FE_API_KEY,
baseURL: "https://formalengines.com/inference/v1",
});
const response = await client.chat.completions.create({
model: "deepseek-v4-1-flash",
messages: [{ role: "user", content: "Explain caching in one sentence." }],
max_tokens: 256,
});
console.log(response.choices[0].message.content);Where to go next
Use model discovery to pick an ID and read context limits. Add streaming for incremental output or tool calling for actions in your application. If a request fails, start with errors and troubleshooting.