glimfly
guide updated

Who owns the code your AI writes?

The short answer

One disclaimer before anything else: this isn’t legal advice, just a plain read of what Anthropic and OpenAI’s contracts actually say and what the US Copyright Office has published, not a substitute for a lawyer who knows your specific situation. Still, yes: in the sense that matters day to day, you own the code your AI agent writes for you. Both companies’ terms of service explicitly assign you whatever rights they hold in the output, so nothing in their contracts stops you from using, shipping, or selling it. Where it gets more complicated is copyright itself: the US Copyright Office has said repeatedly that copyright protects only human authorship, so code that’s purely AI-generated, with nothing of yours added, might not be copyrightable at all. One more nuance: owning your output doesn’t mean you’re the only one who has it, since the same model can generate near-identical code for someone else typing a similar prompt.

What Anthropic and OpenAI’s terms actually say

Read the actual contracts instead of assuming, and the picture is consistent across the two largest providers behind today’s coding agents. Anthropic’s Commercial Terms of Service state that the customer “retains all rights to its Inputs” and “owns its Outputs,” and that Anthropic “hereby assigns to Customer its right, title and interest (if any) in and to Outputs.” OpenAI’s business terms use nearly identical language: the customer “owns all Output,” and “OpenAI hereby assigns to Customer all OpenAI’s right, title, and interest, if any, in and to Output.”

Two details matter more than the legal phrasing itself. First, the words “if any”: both companies are assigning whatever rights they might hold, not granting you a right that didn’t already exist, which is the distinction that matters for everything below. Second, this clause is about your relationship with the AI company, not the rest of the world. It settles that Anthropic or OpenAI won’t turn around and claim your generated code as theirs, a real and reasonable question in the early days of agentic coding. It says nothing about whether you can stop a stranger from writing something similar.

Why owning it and copyrighting it aren’t the same thing

This is the part most “who owns my AI code” conversations skip, and it’s the US Copyright Office’s actual, published position, not a hot take. Since 2023, the Office has stated that copyright protects only “works of authorship” created by a human being, and it applies that rule the same way to a Shakespeare-style poem, a Midjourney image, or a block of generated code. If the traditional elements, the actual structure and expression, were determined by the AI rather than a person, the Office won’t register a copyright for that material. In one of its early test cases, an image described as “autonomously created by a computer algorithm” was refused registration because there was no creative contribution from a human. In another, a comic book combining human-written text with AI-generated images earned a copyright for the human parts and no protection for the images themselves.

Applied to code, the same logic carries through. A function your agent produced from a bare prompt, with nothing of yours added, is the kind of thing the Office would likely treat as unprotectable, just as it would a poem generated the same way. What tips the balance back toward you is exactly what a working developer already does: editing the output, restructuring it, committing your own changes on top of it with git, combining pieces from different generations into a design only you would have chosen, deciding what belongs in which file of your repository. The Office’s own language for this is a work where a human “selects or arranges AI-generated material in a sufficiently creative way,” and that human-authored layer keeps its normal copyright protection regardless of what’s sitting underneath it.

The nuance nobody mentions: owning it doesn’t mean owning it exclusively

Once the first two points feel settled, a third one trips people up: even where you do own your output, that ownership was never exclusive. OpenAI’s business terms say this outright, in a clause called “Similarity of Output”: output “may not be unique, and other users may receive similar content from OpenAI’s services,” and “responses that are requested by and generated for other users are not considered Customer’s Output.” Anthropic’s commercial terms don’t spell out an equivalent clause, but the underlying reality holds regardless of provider: a language model is a probabilistic system, not a vault. Ask it for a common pattern, like a login form, a Stripe webhook handler, or a Next.js API route with the usual error handling, and it tends to produce something structurally close to what it gives the next person who asks a similar question, because that’s what the pattern looks like when it’s done the normal way.

None of this means someone can take your specific project, business logic and branding included, and legally call it their own; that’s a different question from two people independently getting similar boilerplate. But it does mean a resemblance between your app and a stranger’s isn’t automatic proof they copied you, and you shouldn’t expect the courts, or the AI company, to treat commonly-generated scaffolding as something only you can have.

What this actually means day to day

Put together, these are the practical changes to how you build and ship:

  • You can sell it. Every major provider’s terms already give you the commercial rights you need to build, deploy, and sell what you ship. There’s no separate “AI-generated code license” you’re missing.
  • If you’re building a real product with real differentiation, not throwaway scaffolding, and someone copies it, what’s defensible is the part you shaped: your architecture, your business logic, your specific arrangement of features, not the boilerplate an agent could regenerate for anyone else.
  • Ownership of the AI’s output says nothing about the licenses attached to the libraries it pulls in. If your agent adds a dependency to your package.json under a restrictive license, or a generated file leans heavily on a recognizable open-source project, that library’s own license still applies, entirely separately from anything Anthropic or OpenAI’s terms cover.
  • If real money or a real dispute is riding on this, this page describes the general shape of the law, not a specific reading of your repository, your employer’s agreement, or your client contract. That’s a conversation for a lawyer, not a dictionary page.

What Glim would tell you

This is exactly the kind of moment Glim is built for. Glimfly builds Glim, a firefly that sits next to your coding agent and narrates what it’s doing while it works, so when it adds a new dependency or leans on a recognizable chunk of someone else’s code, you see it happen instead of finding out later. For the smaller pieces of vocabulary in this guide, the dictionary breaks them down in plain language, one page at a time.

People also ask

“Can I copyright code that Claude or ChatGPT wrote for me?”

Only the parts you meaningfully shaped. The US Copyright Office has said since 2023 that copyright protects only human authorship, so a function generated from a bare prompt and left untouched likely isn't copyrightable on its own. Once you edit it, restructure it, or arrange it alongside your own code in a way that reflects real creative choices, that layer is copyrightable the normal way. The AI-generated parts underneath just don't get their own separate protection.

“Can someone else legally use code that looks just like mine?”

If it's common scaffolding, like a login form, a webhook handler, or the usual error handling, quite possibly yes, and that alone isn't proof of copying. Both major AI providers' terms note explicitly that model output isn't unique and other users can receive similar content from similar prompts. What stays defensible is the part that's yours: your specific architecture, business logic, and how the pieces fit together, not boilerplate an agent could regenerate for the next person who asks.

“Can I sell an app that's mostly AI-generated code?”

Yes. Anthropic and OpenAI's terms both explicitly assign you the commercial rights to what their models generate for you, so nothing in their contracts blocks you from shipping or selling it. The separate question is what you could legally stop someone else from copying, since the purely AI-generated portions may not carry copyright protection on their own. Only the parts you meaningfully shaped do.

Words from this guide

Want this explained about your own project?

Glim watches your coding agent work and explains your sessions in plain words, live. Join the waitlist to get it first.