Key Takeaways

- Migration requires changing only base_url, api_key, and model ID — existing OpenAI SDK code stays intact
- Not all OpenAI APIs are supported; test tool calling and advanced parameters before moving production workloads
- Model behavior differs even when the API structure matches, so benchmark output quality against your current setup
DigitalOcean now offers Serverless Inference with OpenAI-compatible endpoints, and the migration path is shorter than you'd expect. If you're running a standard Chat Completions workflow with the OpenAI Python SDK, you can switch providers by changing three values: the base URL, your API key, and the model ID. The rest of your code stays the same.
Disclosure
Some links in this post are affiliate links — Logicity earns a commission if you sign up, at no extra cost to you. We only link products we have used or actively recommend.
That's the good news. The bad news: "compatible" doesn't mean "identical." Some OpenAI APIs aren't supported at all. Some parameters that look the same behave differently depending on which model you choose. And swapping model IDs doesn't magically make Llama 3.3 70B behave like GPT-4o. This guide covers what actually works, what breaks, and whether DigitalOcean's service qualifies as a drop-in replacement.
What changes between OpenAI and DigitalOcean?
Here's a before-and-after comparison. The OpenAI version looks like this:
import os
from openai import OpenAI
client = OpenAI(
api_key=os.getenv("OPENAI_API_KEY"),
)
resp = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Tell me a fun fact about octopuses."},
],
)
print(resp.choices[0].message.content)And here's the DigitalOcean equivalent:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://inference.do-ai.run/v1",
api_key=os.getenv("MODEL_ACCESS_KEY"),
)
resp = client.chat.completions.create(
model="llama3.3-70b-instruct",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Tell me a fun fact about octopuses."},
],
)
print(resp.choices[0].message.content)Three changes. That's it. The SDK import is identical. The method calls are identical. The response structure is identical.
Where do you get the credentials?
Your OpenAI API key won't work here. You need a DigitalOcean Model Access Key, which you create in the Control Panel under Inference > Serverless Inference. The HTTP authentication mechanism is the same (Bearer token), but the credential itself is different. DigitalOcean also supports personal access tokens if you're already using those for other DO services.
How do model IDs work?
Model IDs are DigitalOcean-specific. llama3.3-70b-instruct is a catalog identifier, not an OpenAI model name that happens to work on both platforms. The catalog changes over time as DigitalOcean adds or removes models.
Don't guess model names. Call GET /v1/models or check the Model Catalog in the Control Panel to see what's currently available. If you hardcode a model ID and DigitalOcean deprecates it, your production calls will fail.
Does streaming work?
Yes. The streaming interface mirrors OpenAI's SDK pattern:
stream = client.chat.completions.create(
model="llama3.3-70b-instruct",
messages=[{"role": "user", "content": "Write a haiku about Kubernetes."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)If you prefer raw HTTP over the SDK, curl works the same way:
Code sample: curl -X POST https://inference.do-ai.run/v1/chat/completions \
-H "Authorization: Bearer $MODEL_ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "llama3.3-70b-instruct",
"messages": [{"role": "user", "content": "What is the capital of France?"}],
"temperature": 0.7,
"max_completion_tokens": 256
}'
Which OpenAI endpoints does DigitalOcean support?
DigitalOcean's documentation confirms support for Chat Completions, the /v1/models listing endpoint, and streaming. The specifics on tool calling, function calling, and embeddings are model-dependent. Some models support these features; others don't.
Request parameters can also vary by model. Don't assume every OpenAI parameter (temperature, top_p, presence_penalty, etc.) behaves identically across every model in the catalog. Check current documentation before relying on advanced parameters in production.
What doesn't DigitalOcean support?
The source confirms that some OpenAI APIs are explicitly unsupported, though the exact list isn't detailed. Based on the nature of serverless inference, expect gaps in: fine-tuning endpoints, Assistants API, file uploads, batch processing, and vision/multimodal inputs (unless specific models support them). Verify against DigitalOcean's current documentation before assuming parity.
Is this a true drop-in replacement?
No. It's close for basic Chat Completions workflows, but "OpenAI-compatible" doesn't mean "OpenAI-identical." Three caveats matter here.
First, model behavior differs. Llama 3.3 70B is a capable model, but it won't produce the same outputs as GPT-4o for the same prompts. Context limits, instruction-following style, and edge-case handling all vary. Test output quality before moving production workloads.
Second, not all endpoints exist. If your application uses Assistants, fine-tuning, or other OpenAI-specific features, you'll need workarounds or a hybrid setup.
Third, parameter support varies by model. A parameter that works with one model in the catalog might be ignored or error out on another.
Logicity's Take
For engineering teams evaluating OpenAI alternatives, DigitalOcean's approach is pragmatic: keep the SDK, change the endpoint, access open-source models at likely lower cost. The 70-90% cost savings often cited for self-hosted open-source inference won't directly translate to serverless pricing, but you're trading operational complexity for managed infrastructure. Compare this against other hosted inference options like AWS Bedrock, Google Vertex AI, or Together AI before committing. If your workload is Chat Completions with Llama-class models, the migration is straightforward. If you're deep into the OpenAI ecosystem (Assistants, GPT-4 Vision, fine-tuned models), expect gaps.
Frequently Asked Questions
Can I use my existing OpenAI Python SDK with DigitalOcean?
Yes. Keep the same SDK import and method calls. Only change base_url, api_key, and model ID.
What models are available on DigitalOcean Serverless Inference?
The catalog includes models like Llama 3.3 70B Instruct and others. Call GET /v1/models or check the Control Panel for the current list, as it changes over time.
Does DigitalOcean support OpenAI's function calling?
Support varies by model. Some models in the catalog support tool/function calling; others don't. Check documentation for your specific model.
Will my prompts produce the same outputs on DigitalOcean?
No. Different models produce different outputs even with identical prompts. Benchmark your specific use cases before migrating production traffic.
How much cheaper is DigitalOcean than OpenAI?
Pricing depends on model, usage volume, and your current OpenAI tier. DigitalOcean's serverless pricing differs from self-hosted savings estimates. Compare directly against your invoice.
If you're orchestrating AI calls across multiple services, Zapier's new positioning addresses multi-model workflows
Need Help Implementing This?
Building an AI-powered product and weighing inference providers? We help engineering teams evaluate cost, latency, and model quality tradeoffs. Reach out at hello@logicity.in.
Huma Shazia
Senior AI & Tech Writer
Produced with AI assistance and reviewed by the Logicity editorial team. Learn more in our Editorial Policy.
Related Articles
More in Tutorials & How-To
CVE Vulnerability Tracker: How to Build an Automated Security Dashboard with Notion and Kestra
A developer shares her journey building an automated CVE vulnerability tracker using Notion's database plugins and Kestra workflows. The tutorial covers plugin defaults, handling tricky data types like rich text arrays, and integrating AI for priority assessment.

CoreOptimize FPS Calculator: Build Your Own Game Performance Estimator in 30 Minutes
Tired of downloading games only to find they run like a slideshow? This tutorial walks you through building a simple FPS calculator that estimates game performance based on your actual hardware specs. No frameworks needed, just HTML and JavaScript.

ReactFlow Multi-Selection Tutorial: Building Undo/Redo and Box Selection From Scratch
A deep technical walkthrough of implementing multi-selection with undo/redo in ReactFlow. The ArchScope team shares their coordinate transformation nightmares, event handling gotchas, and the solutions that actually worked.



