Java AI API client (India)
Configure a Java OpenAI SDK client's baseUrl for unoblox to call GPT, Claude, DeepSeek and Qwen with rupee pricing and a monthly GST invoice.
Not every Java backend uses Spring — plenty of batch jobs, Android-adjacent backends and plain Maven services call AI models through a bare Java OpenAI SDK instead of a framework abstraction. Those SDKs already expose a configurable base URL, which is all a Java service needs to move from an internationally billed host to unoblox's rupee-billed, OpenAI-compatible endpoint.
Configuring the client
OpenAIClient client = OpenAIOkHttpClient.builder()
.baseUrl("https://api.unoblox.ai/v1")
.apiKey("ub-gw-xxxxxxxxxxxxxxxxxxxxxxxxxxxx")
.build();
ChatCompletionCreateParams params = ChatCompletionCreateParams.builder()
.model("openai/gpt-5-mini")
.addUserMessage("Classify this ticket as billing, technical, or other.")
.build();
ChatCompletion completion = client.chat().completions().create(params);
System.out.println(completion.choices().get(0).message().content());
The builder pattern, the response types and the blocking or async call shape all stay as documented — baseUrl and apiKey are the only two lines that change.
Choosing a model for a backend service
| Model id | ₹ / 1M input | ₹ / 1M output |
|---|---|---|
openai/gpt-5-mini | ₹25.20 | ₹201.60 |
qwen/qwen3-235b-a22b-instruct-2507 | ₹9.07 | ₹55.44 |
moonshotai/kimi-k2.7-code | ₹68.50 | ₹342.70 |
qwen/qwen3-1.7b (free) | ₹0.00 | ₹0.00 |
moonshotai/kimi-k2.7-code is a reasonable default to evaluate for code-heavy Java services given its naming, but validate it against your own workload before committing — don't assume a model's fit from its name alone. Anything not listed here should be priced from its live /models page.
Thread pools and batching
Java backends often fan a single incoming request out into several model calls (classification, then extraction, then a summary). Because unoblox meters by token rather than by request, batching those calls into fewer, larger prompts where your logic allows it reduces overhead without changing the per-token rate you pay. If you're running a fixed-size thread pool for outbound HTTP calls, the same connection-pooling settings you'd use against any HTTPS API apply unchanged here.
Dependency management
Add whichever Java OpenAI-compatible SDK your team already uses (via Maven or Gradle) — unoblox doesn't require a fork or a vendor-specific artifact, since the wire format is the standard OpenAI chat-completions shape.
The invoice difference
Nothing about the Java code implies a currency. What changes is that unoblox settles in rupees on a monthly GST invoice from an Indian entity, claimable as input tax credit, with no international card needed to get a key issued.
Frequently asked questions
Which Java SDK should I use? Any Java client built for the OpenAI chat-completions API works, since that's the protocol unoblox implements — set baseUrl and apiKey to unoblox's values.
Does tool/function calling work? Yes, unoblox implements the same tool-calling contract, so SDK-level function-calling builders work unchanged.
Can I run this from a Spring Boot app too? Yes, though if you're already on Spring AI, its dedicated starter (see our Spring AI guide) is a slightly cleaner fit.
Is there a free model for local development? Yes — qwen/qwen3-1.7b is priced at ₹0.
How do I keep the key out of source control? Load it from environment configuration or a secrets manager at startup, the same way you'd handle any other API credential.
How is usage billed? In rupees, on a monthly GST invoice from an Indian entity, with input tax credit claimable.
Get started in rupees → https://unoblox.ai/sign-in
Start building in rupees
Call every major model through one OpenAI-compatible endpoint, billed in ₹ on a GST invoice.