{"id":50725332,"url":"https://github.com/oracle-samples/oci-genai-auth-java","last_synced_at":"2026-07-06T21:00:14.303Z","repository":{"id":346666444,"uuid":"1186055113","full_name":"oracle-samples/oci-genai-auth-java","owner":"oracle-samples","description":"OCI GenAI Auth for Java — OCI request-signing library for OpenAI-compatible APIs on Oracle Cloud Infrastructure Generative AI","archived":false,"fork":false,"pushed_at":"2026-06-09T04:22:06.000Z","size":124,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-10T03:32:58.769Z","etag":null,"topics":["agenthub","authentication","generative-ai","java","oci","oci-genai","openai","oracle-cloud"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"upl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oracle-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-19T08:10:38.000Z","updated_at":"2026-06-09T04:22:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/oracle-samples/oci-genai-auth-java","commit_stats":null,"previous_names":["oracle-samples/oci-genai-auth-java"],"tags_count":3,"template":false,"template_full_name":"oracle/template-repo","purl":"pkg:github/oracle-samples/oci-genai-auth-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-samples%2Foci-genai-auth-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-samples%2Foci-genai-auth-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-samples%2Foci-genai-auth-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-samples%2Foci-genai-auth-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oracle-samples","download_url":"https://codeload.github.com/oracle-samples/oci-genai-auth-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle-samples%2Foci-genai-auth-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35205739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-06T02:00:07.184Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agenthub","authentication","generative-ai","java","oci","oci-genai","openai","oracle-cloud"],"created_at":"2026-06-10T03:31:38.911Z","updated_at":"2026-07-06T21:00:14.297Z","avatar_url":"https://github.com/oracle-samples.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# oci-genai-auth-java\n\nThe **OCI GenAI Auth** Java library provides OCI request-signing helpers for the OpenAI-compatible REST APIs hosted by OCI Generative AI.\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Using OCI IAM Auth](#using-oci-iam-auth)\n- [Using API Key Auth](#using-api-key-auth)\n- [Using OCI Enterprise AI Agents APIs](#using-oci-enterprise-ai-agents-apis)\n- [Examples](#examples)\n- [Release Notes](#release-notes)\n- [Contributing](#contributing)\n- [Security](#security)\n- [License](#license)\n\n## Installation\n\nRequires **Java 17+** and **Maven 3.8+**.\n\n`oci-genai-auth-java` is designed to work together with the official [OpenAI Java SDK](https://github.com/openai/openai-java).\n\n```xml\n\u003cdependencyManagement\u003e\n    \u003cdependencies\u003e\n        \u003cdependency\u003e\n            \u003cgroupId\u003ecom.oracle.genai\u003c/groupId\u003e\n            \u003cartifactId\u003eoci-genai-auth-java-bom\u003c/artifactId\u003e\n            \u003cversion\u003e1.0.11\u003c/version\u003e\n            \u003ctype\u003epom\u003c/type\u003e\n            \u003cscope\u003eimport\u003c/scope\u003e\n        \u003c/dependency\u003e\n    \u003c/dependencies\u003e\n\u003c/dependencyManagement\u003e\n\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.oracle.genai\u003c/groupId\u003e\n        \u003cartifactId\u003eoci-genai-auth-java-core\u003c/artifactId\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\n## Using OCI IAM Auth\n\nUse OCI IAM auth when you want to sign requests with your OCI profile (session/user/resource/instance principal). Recommended if you are building OCI-native production workloads.\n\n```java\nimport com.oracle.genai.auth.OciAuthConfig;\nimport com.oracle.genai.auth.OciOkHttpClientFactory;\nimport com.oracle.genai.auth.OciOpenAIHttpClient;\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.OpenAIClientImpl;\nimport com.openai.core.ClientOptions;\nimport okhttp3.OkHttpClient;\n\nOciAuthConfig config = OciAuthConfig.builder()\n        .authType(\"security_token\")\n        .profile(\"DEFAULT\")\n        .build();\n\nOkHttpClient ociHttpClient = OciOkHttpClientFactory.build(config);\n\nString baseUrl = \"https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/openai/v1\";\n\nOpenAIClient client = new OpenAIClientImpl(ClientOptions.builder()\n        .httpClient(OciOpenAIHttpClient.of(ociHttpClient, baseUrl))\n        .baseUrl(baseUrl)\n        .apiKey(\"not-used\")\n        .build());\n```\n\n## Using API Key Auth\n\nUse OCI Generative AI API Keys if you want a long-lived API key style auth. Recommended if you are migrating from other OpenAI-compatible API providers.\n\nTo create the OCI Generative AI API Keys, follow [this guide](https://docs.oracle.com/en-us/iaas/Content/generative-ai/api-keys.htm).\n\nYou don't need to install `oci-genai-auth-java` if you use API key auth.\n\n```java\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\n\nOpenAIClient client = OpenAIOkHttpClient.builder()\n        .baseUrl(\"https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/openai/v1\")\n        .apiKey(System.getenv(\"OCI_GENAI_API_KEY\"))\n        .build();\n```\n\n## Using OCI Enterprise AI Agents APIs\n\nOCI Enterprise AI Agents provides a unified API for interacting with models and agentic capabilities.\n\n- It is compatible with OpenAI's Responses API and the [Open Responses Spec](https://www.openresponses.org/specification), enabling developers to build agents with OpenAI SDK, OpenAI Agents SDK, LangChain, LangGraph, AI SDK, CrewAI, and more.\n- It offers a uniform interface, auth, billing to access multiple model providers including OpenAI, Gemini, xAI, and GPT-OSS models hosted in OCI and your Dedicated AI Cluster.\n- It provides built-in agentic primitives such as agent loop, reasoning, short-term memory, long-term memory, web search, file search, image generation, code execution, and more.\n\nIn addition to the compatible endpoint to Responses API, OCI Enterprise AI Agents also offers compatible endpoints to Files API, Vector Stores API, and Containers API.\n\nExplore [examples](examples/enterprise_ai_agents) to get started.\n\nNote: OpenAI commercial models and image generation are only available to Oracle internal teams at this moment.\n\n```java\nimport com.oracle.genai.auth.OciAuthConfig;\nimport com.oracle.genai.auth.OciOkHttpClientFactory;\nimport com.oracle.genai.auth.OciOpenAIHttpClient;\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.OpenAIClientImpl;\nimport com.openai.core.ClientOptions;\nimport okhttp3.OkHttpClient;\n\nOciAuthConfig config = OciAuthConfig.builder()\n        .authType(\"security_token\")\n        .profile(\"DEFAULT\")\n        .build();\n\nOkHttpClient ociHttpClient = OciOkHttpClientFactory.build(config);\n\nString baseUrl = \"https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/openai/v1\";\n\nOpenAIClient client = new OpenAIClientImpl(ClientOptions.builder()\n        .httpClient(OciOpenAIHttpClient.of(ociHttpClient, baseUrl))\n        .baseUrl(baseUrl)\n        .apiKey(\"not-used\")\n        .putHeader(\"openai-project\", \"ocid1.generativeaiproject.oc1.us-chicago-1.aaaaaaaaexample\")\n        .build());\n```\n\n## Examples\nDemo code and instructions on how to run them can be found in [examples](examples/) folder.\n\n## Release Notes\n\nSee [RELEASE_NOTES.md](./RELEASE_NOTES.md).\n\n## Contributing\n\nThis project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md)\n\n## Security\n\nPlease consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process\n\n## License\n\nCopyright (c) 2026 Oracle and/or its affiliates.\n\nReleased under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle-samples%2Foci-genai-auth-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foracle-samples%2Foci-genai-auth-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle-samples%2Foci-genai-auth-java/lists"}